Warning: realpath(): open_basedir restriction in effect. File(/www/wwwroot) is not within the allowed path(s): (/www/wwwroot/dlgcy_com/:/tmp/) in /www/wwwroot/dlgcy_com/wp-content/plugins/wp-file-manager/classes/backup-storage.php on line 119

Warning: realpath(): open_basedir restriction in effect. File(/www) is not within the allowed path(s): (/www/wwwroot/dlgcy_com/:/tmp/) in /www/wwwroot/dlgcy_com/wp-content/plugins/wp-file-manager/classes/backup-storage.php on line 119

Warning: realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/www/wwwroot/dlgcy_com/:/tmp/) in /www/wwwroot/dlgcy_com/wp-content/plugins/wp-file-manager/classes/backup-storage.php on line 119
SVN相关文章列表 - 独立观察员

SVN 命令行获取提交日志

SVN 命令行获取提交日志

独立观察员 2022年7月24日

一、命令帮助

svn help log

 

帮助内容:

>svn help log
log: Show the log messages for a set of revision(s) and/or path(s).
usage: 1. log [PATH][@REV]
       2. log URL[@REV] [PATH...]

  1. Print the log messages for the URL corresponding to PATH (default: '.'). 
     If specified, REV is the revision in which the URL is first looked up, and the default revision range is REV:1.
     If REV is not specified, the default revision range is BASE:1, since the URL might not exist in the HEAD revision.

  2. Print the log messages for the PATHs (default: '.') under URL.
     If specified, REV is the revision in which the URL is first looked up, and the default revision range is REV:1; 
     otherwise, the URL is looked up in HEAD, and the default revision range is HEAD:1.

  Multiple '-c' or '-r' options may be specified (but not a combination of '-c' and '-r' options), and mixing of forward and reverse ranges is allowed.

  With -v, also print all affected paths with each log message.
  Each changed path is preceded with a symbol describing the change:
    A: The path was added or copied.
    D: The path was deleted.
    R: The path was replaced (deleted and re-added in the same revision).
    M: The path's file and/or property content was modified.
  If an added or replaced path was copied from somewhere else, the copy source path and revision are shown in parentheses.
  If a file or directory was moved from one path to another with 'svn move' the old path will be listed as deleted and the new path will be listed as copied from the old path at a prior revision.

  With -q, don't print the log message body itself (note that this is compatible with -v).

  Each log message is printed just once, even if more than one of the affected paths for that revision were explicitly requested.  
  Logs follow copy history by default.  
  Use --stop-on-copy to disable this behavior, which can be useful for determining branchpoints.

  The --depth option is only valid in combination with the --diff option and limits the scope of the displayed diff to the specified depth.

  If the --search option is used, log messages are displayed only if the provided search pattern matches any of the author, date, log message text (unless --quiet is used), or, if the --verbose option is also  provided, a changed path.
  The search pattern may include "glob syntax" wildcards:
      ?      matches any single character
      *      matches a sequence of arbitrary characters
      [abc]  matches any of the characters listed inside the brackets
  If multiple --search options are provided, a log message is shown if it matches any of the provided search patterns. If the --search-and option is used, that option's argument is combined with the pattern
  from the previous --search or --search-and option, and a log message is shown only if it matches the combined search pattern.
  If --limit is used in combination with --search, --limit restricts the number of log messages searched, rather than restricting the output to a particular number of matching log messages.

  Examples:

    Show the latest 5 log messages for the current working copy directory and display paths changed in each commit:
      svn log -l 5 -v

    Show the log for bar.c as of revision 42:
      svn log bar.c@42

    Show log messages and diffs for each commit to foo.c:
      svn log --diff http://www.example.com/repo/project/foo.c
    (Because the above command uses a full URL it does not require a working copy.)

    Show log messages for the children foo.c and bar.c of the directory '/trunk' as it appeared in revision 50, using the ^/ URL shortcut:
      svn log ^/trunk@50 foo.c bar.c

    Show the log messages for any incoming changes to foo.c during the next 'svn update':
      svn log -r BASE:HEAD foo.c

    Show the log message for the revision in which /branches/foo was created:
      svn log --stop-on-copy --limit 1 -r0:HEAD ^/branches/foo

    Show all log messages for commits between the tags ^/tags/2.0 and ^/tags/3.0; assuming that tag 2.0 was created in revision 100:
      svn log -rHEAD:100 ^/tags/3.0

    If ^/trunk/foo.c was moved to ^/trunk/bar.c' in revision 22, 'svn log -v' shows a deletion and a copy in its changed paths list, such as:
       D /trunk/foo.c
       A /trunk/bar.c (from /trunk/foo.c:21)

Valid options:
  -r [--revision] ARG      : ARG (some commands also take ARG1:ARG2 range)
                             A revision argument can be one of:
                                NUMBER       revision number
                                '{' DATE '}' revision at start of the date
                                'HEAD'       latest in repository
                                'BASE'       base rev of item's working copy
                                'COMMITTED'  last commit at or before BASE
                                'PREV'       revision just before COMMITTED
  -c [--change] ARG        : the change made in revision ARG
  -q [--quiet]             : do not print the log message
  -v [--verbose]           : also print all affected paths
  -g [--use-merge-history] : use/display additional information from merge
                             history
  --targets ARG            : pass contents of file ARG as additional args
  --stop-on-copy           : do not cross copies while traversing history
  --incremental            : give output suitable for concatenation
  --xml                    : output in XML
  -l [--limit] ARG         : maximum number of log entries
  --with-all-revprops      : retrieve all revision properties
  --with-no-revprops       : retrieve no revision properties
  --with-revprop ARG       : retrieve revision property ARG
  --depth ARG              : limit operation by depth ARG ('empty', 'files',
                             'immediates', or 'infinity')
  --diff                   : produce diff output
  --diff-cmd ARG           : use ARG as diff command
  --internal-diff          : override diff-cmd specified in config file
  -x [--extensions] ARG    : Specify differencing options for external diff or internal diff or blame. Default: '-u'. 
                             Options are separated by spaces. Internal diff and blame take:
                               -u, --unified: Show 3 lines of unified context
                               -b, --ignore-space-change: Ignore changes in
                                 amount of white space
                               -w, --ignore-all-space: Ignore all white space
                               --ignore-eol-style: Ignore changes in EOL style
                               -U ARG, --context ARG: Show ARG lines of context
                               -p, --show-c-function: Show C function name
  --search ARG             : use ARG as search pattern (glob syntax, case-
                             and accent-insensitive, may require quotation marks to prevent shell expansion)
  --search-and ARG         : combine ARG with the previous search pattern

(Use '-v' to show global and experimental options.)

 

二、显示某个日期或日期范围的日志

2.1 某个日期的日志

svn log -r '{20220719}'

 

这个命令参数解释是:revision at start of the date。

实际情况如下:

%title插图%num

 

可以看到,每次基本只能显示一条记录,大致是给定的日期开始时的最新版本的提交日志,所以获取的是给定日期前(前一天或更早之前)。但是有一个参数为当天(20220720)的,获取结果为空,不知何故。

 

2.2 某个日期范围的日志

这个需求,帮助文档中没有体现,经过摸索,命令格式如下:

svn log -r '{20220719}:{20220720}'

 

效果:

%title插图%num

 

当天(20220720)更新到新的提交后,使用范围命令感觉就正常了(但是和前面的效果感觉是两套逻辑呀):

%title插图%num

 

以上为在 PowerShell 中的情况,在命令提示符中需要将参数的引号去掉:

%title插图%num

 

2.3 获取当天的提交日志

说明:基于 “2.2 某个日期范围的日志”,动态获取当天和第二天的日期并拼接为参数。

GetCommitLog.bat:

:@echo off

set Today=%date:~0,4%-%date:~5,2%-%date:~8,2%
echo 当前日期是:%Today%

echo Wscript.echo dateadd("d",1,date)>vbs.vbs
for /f %%a in ('cscript /nologo vbs.vbs') do del vbs.vbs&&set yyyymmdd=%%a
for /f "tokens=1,2,3* delims=// " %%i in ('echo %yyyymmdd%') do set yyyy=%%i&set mm=%%j&set dd=%%k
if   %mm%   LSS   9   set   mm=0%mm%
if   %dd%   LSS   9   set   dd=0%dd%
set tomorrow=%yyyy%-%mm%-%dd%
echo tomorrow is : %tomorrow%

set para={%Today%}:{%tomorrow%}

SETLOCAL ENABLEDELAYEDEXPANSION
for /f "delims=" %%i in ('svn log -r %para%') do ( set str=!str! %%i )
echo "%str%"
pause

 

效果(乱入了前一天的日志,这是之前说过的问题):

%title插图%num

 

注:获取当天和第二天日期的脚本参考以下两篇文章,《[bat 文件 cmd 命令获取系统日期格式](https://blog.51cto.com/lexsaints/2806267)》和《[bat 获取明天日期](https://blog.csdn.net/weixin_41710606/article/details/115673362)》

 

全文完。

 

在 Windows 上搭建配置 Jenkins 然后编译打包 VS 项目

在 Windows 上搭建配置 Jenkins 然后编译打包 VS 项目

魏刘宏 2022 年 7 月 6 日

 

一、安装

1、下载并安装 JRE (Java 运行环境)。

2、下载 Windows 版本的 Jenkins 安装包并安装。

3、安装 Visual Studio,以供编译项目使用。

4、安装 Advanced Installer,以供打包项目使用。

 

二、Jenkins 配置

Jenkins 安装完成后,使用 IP 端口,在浏览器中可打开使用 Jenkins,如 http://192.168.70.150:8080/manage

%title插图%num

 

Jenkins 的配置文件在其安装目录下,可修改其中一些配置(如数据存放目录),重启 Jenkins 后生效。

%title插图%num

 

重启 Jenkins 的方法为:在主页地址后加 “/restart” 并访问,如下:

%title插图%num

 

2.1、管理插件

首先在 “高级” 选项卡中可进行一些设置,如 设置代理、手动安装插件、设置升级站点:

%title插图%num

%title插图%num

 

一个可用的升级站点为 https://updates.jenkins-zh.cn/update-center.json

 

接下来介绍一些已安装的插件:

%title插图%num

%title插图%num

%title插图%num

%title插图%num

%title插图%num

%title插图%num

%title插图%num

 

2.2、全局工具配置

可对一些插件进行配置,如下。

 

2.2.1、配置 Advanced Installer 安装路径

%title插图%num

 

2.2.2、配置 MSBuild 路径

%title插图%num

 

2.3、配置系统

有一些 Jenkins 的配置,一般无需更改。

%title插图%num

 

也会有些插件的功能需要在这里配置,如下。

 

2.3.1 配置全局构建超时

%title插图%num

 

2.3.2 配置时间戳

%title插图%num

 

2.3.3 SVN 配置

%title插图%num

 

三、构建项目编译任务

%title插图%num

 

输入任务名称,选择 Freestyle project 即可,也可以使用复制功能:

%title插图%num

 

下面以 MD96_Bugfix_MSBuild 为例,点击配置开始编辑:

%title插图%num

 

3.1、设置 丢弃旧的构建

%title插图%num

 

3.2、源码管理

源码管理选择 SVN 并配置相关信息:

%title插图%num

 

其它的默认即可:

%title插图%num

 

3.3、构建触发器

定期构建(2022.07.17 更新)

勾上 Build periodically,在 “日程表” 框中填写规则:

%title插图%num

 

“日程表” 后问号的详细规则:

%title插图%num

 

基本规则就是:

MINUTE HOUR DOM MONTH DOW​
分钟 小时 日 月 星期几

 

H H * * *  代表每日执行,不过时间是不固定的(对于不同任务来说)。* 号代表所有。H 是任务名称的某种 hash 值,所以每个任务的 H 值是稳定的。当然,可以在 H 后指定范围。

例如,H(0-20) H(17-18) * * 1-5 代表在【周一到周五的每一天的 17:00-18:59 的 0-20 分钟之间】进行构建:

%title插图%num

 

3.4、构建环境

%title插图%num

 

3.5、增加构建步骤

增加构建步骤选择 “Build a Visual Studio project or solution using MSBuild”:

%title插图%num

 

配置 MSBuild 的相关编译参数:

%title插图%num

 

需要编译几个项目,就建几个步骤,不再赘述。

 

最后来一段拷贝文件的 bat 指令,步骤类型为 “Execute Windows batch command”:

%title插图%num

 

如果会有 SVN Checkout 操作后产生冲突的情况,还可以再添加一个 “Execute Windows batch command” 的步骤,调用 SVN 命令行工具来进行还原:

%title插图%num

 

四、构建打包任务

以 MD96_Package_Plugin 任务为例:

%title插图%num

 

丢弃旧的构建和上一章一样配置;无需配置源码管理;构建触发器、构建环境等按需配置。

 

直接增加一个类型为 “Invoke Advanced Installer” 的构建步骤。

如果 Run Type 选择第一个,调用,则没有具体配置选项,应该就是唤起打包程序吧(未测试):

%title插图%num

 

所以选择第二个,调用并构建项目,填入 aip 打包文件路径:

%title插图%num

 

其余配置全部留空:

%title插图%num

 

完成后点击 “Build Now” 即可开始构建。

 

五、简单使用介绍

5.1、运行

5.1.1、方法一

鼠标移到列表中相关任务右边,点击出现的下拉箭头:

%title插图%num

 

在下拉列表中点击 “Build Now”:

%title插图%num

 

5.1.2、方法二

点击列表中的某个任务,在打开的页面左侧点击 “Build Now”:

%title插图%num

 

5.2、查看结果

开始构建后,左下角构建历史区会出现正在进行的构建,鼠标移上会出现下拉箭头:

%title插图%num

 

点击下拉框中的 “控制台输出” 可实时查看输出,也可查看之前的构建的输出:

%title插图%num

 

以下为打包任务正在进行的输出:

%title插图%num

 

最终输出如下(有中文乱码,不影响):

%title插图%num

 

感谢阅读!

 

使用TortoiseSVN将某个SVN目录下的目录指向另一个仓库

使用TortoiseSVN将某个SVN目录下的目录指向另一个仓库

——独立观察员 2015.04.09

哈哈,不知道大家有没有这种需求,是不是看到标题感到有点蛋疼呢?无论如何,我今天想要实现这个操作,发现还不是那么容易的呢。可能使用原生SVN或者使用命令行可以比较容易达到这个效果吧(不知道,也可能不行),不过虽然我是个程序员,但坦白说我并不喜欢命令行。所以,我就寻求直接使用TortoiseSVN的图形化操作来达成的方法。没想到还真成了,不敢独享,分享如下。

先来看看TortoiseSVN的机制:

%title插图%num

也就是一个SVN主目录(指定了一个仓库了的)下有个”.svn”目录,用于存储一些信息。在主目录内的空白处右键,可看到TortoiseSVN的菜单,在”导出”下面有个”重新定位”的选项,这就是用于重新指定数据仓库的指令,当然,这是用于切换整个SVN目录的仓库的。

可以看到,切换还是挺方便的:

%title插图%num

 

那么,在子目录下能不能同样地操作呢?我们来试试,进入子目录,然后右键展开菜单:

%title插图%num

可以看到,此处不再出现”重新定位”选项了,也就是说不能如前面那样操作了。

 

那么怎么办呢?其实也很简单。既然”.svn”是存储相关信息的,那么我们不让它读到相关信息不就好了嘛。

具体方法有移动目录或改名等,移来移去太麻烦了,我们来改名吧 —— 在”.svn”的最前面添加一些字符:

%title插图%num

 

此时无论在此目录或子目录内右键,都可发现相关菜单项减少了很多:

%title插图%num

也就是TortoiseSVN不认为这是个SVN目录了。

 

这样,我们就可以在子目录中右键–>”SVN检出”,然后在弹出窗口中就可以任意选择SVN仓库地址进行检出了:

%title插图%num

其实我本次是想将放在新浪SAE的SVN目录中的一些内容传到开源中国的Git@OSC代码托管仓库中,所以我先选择的是”导入”操作:

%title插图%num

 

反正经过一番操作之后,该子目录被认可为SVN目录了:

%title插图%num

 

现在来恢复外层目录为原来的SVN目录,只需将相关文件夹改回原来的”.svn”名字即可。不过,在Windows下还有些不同,直接将前面添加的字符删去,会提示”必须键入文件名”,就跟开始时如果只在最后添加字符是一样的错误:

%title插图%num

 

可参考《教你如何在Windows平台上创建以点(.)开头的文件名》。此处只需在删除前面的字符时同时在最后加个点即可,最后的点系统会自动忽略:

%title插图%num

 

好了,现在为了看看两个库是不是都能用,我们在相关子目录中添加个文件:

%title插图%num

 

然后分别在”这个目录内空白处”和”上层目录空白处”右键–>”SVN提交”:

%title插图%num

可见是都能提交的。

 

这样我们就能更加灵活地使用SVN了,祝大家使用愉快!