获取SVN存储库中特定文件的所有修订版本

通过一个sed脚本来管理所有内容,而不是greps和awks的管道。在sed脚本中引用shell变量通常更容易。
.

0

linux命令:svn log fileName | sed -ne "/^r\([0-9][0-9]*\).*/{;s//\1/;s/.*/svn cat fileName@& > fileName.r&/p;}" | sh -s -s sh | fileName.r&/p;}" > fileName@& cat "/^r\([0-9][0-9]*\).*/{;s//\1/;s/.*/svn -ne sed | fileName log svn svn log fileName | sed -ne "/^r\([0-9][0-9]*\).*/{;s//\1/;s/.*/svn cat fileName@& > fileName.r&/p;}" | sh -srootopen.com
linux命令:svn log fileName | sed -ne "/^r\([0-9][0-9]*\).*/{;s//\1/;s/.*/svn cat fileName@& > fileName.r&/p;}" | sh -s -s sh | fileName.r&/p;}" > fileName@& cat "/^r\([0-9][0-9]*\).*/{;s//\1/;s/.*/svn -ne sed | fileName log svn svn log fileName | sed -ne "/^r\([0-9][0-9]*\).*/{;s//\1/;s/.*/svn cat fileName@& > fileName.r&/p;}" | sh -srootopen.com
skcu 2018-03-14 19:45:48
输出
替代方案1 获取SVN存储库中特定文件的所有修订版本

导出的文件将获得.r23扩展名(其中23是修订版号).

linux命令:svn log fileName|cut -d" " -f 1|grep -e "^r[0-9]\{1,\}$"|awk {'sub(/^r/,"",$1);print "svn cat fileName@"$1" > /tmp/fileName.r"$1'}|sh /tmp/fileName.r"$1'}|sh > fileName@"$1" cat "svn {'sub(/^r/,"",$1);print "^r[0-9]\{1,\}$"|awk -e 1|grep -f " -d" fileName|cut log svn svn log fileName|cut -d" " -f 1|grep -e "^r[0-9]\{1,\}$"|awk {'sub(/^r/,"",$1);print "svn cat fileName@"$1" > /tmp/fileName.r"$1'}|shrootopen.com
linux命令:svn log fileName|cut -d" " -f 1|grep -e "^r[0-9]\{1,\}$"|awk {'sub(/^r/,"",$1);print "svn cat fileName@"$1" > /tmp/fileName.r"$1'}|sh /tmp/fileName.r"$1'}|sh > fileName@"$1" cat "svn {'sub(/^r/,"",$1);print "^r[0-9]\{1,\}$"|awk -e 1|grep -f " -d" fileName|cut log svn svn log fileName|cut -d" " -f 1|grep -e "^r[0-9]\{1,\}$"|awk {'sub(/^r/,"",$1);print "svn cat fileName@"$1" > /tmp/fileName.r"$1'}|shrootopen.com
.
输出

评论

相关推荐

如果文件名中没有空格,则更简单的命令就足够了。即使文件名中有空格和某些特殊字符,此单行也可以工作。 svn st 显示Subversion结帐中的更改 | grep ^? 仅匹配以问号开头的行(=未版本控制的文件) | sed -e 's/^? *//' 删除行开头的问号和后面的空格字符 | xargs -i{} echo rm -fr "{}"对输入中的每一行执行一个echo命令,通过在{}占位符中插入输入行来形成命令。确认结果看起来不错并删除echo以执行rm。

linux命令:svn st | grep ^? | sed -e 's/^? *//' | xargs -i{} echo rm -fr "{}" "{}" -fr rm echo -i{} xargs | *//' 's/^? -e sed | ^? grep | st svn svn st | grep ^? | sed -e 's/^? *//' | xargs -i{} echo rm -fr "{}"rootopen.com
linux命令:svn st | grep ^? | sed -e 's/^? *//' | xargs -i{} echo rm -fr "{}" "{}" -fr rm echo -i{} xargs | *//' 's/^? -e sed | ^? grep | st svn svn st | grep ^? | sed -e 's/^? *//' | xargs -i{} echo rm -fr "{}"rootopen.com
.

如果文件已经在SVN中,--force选项会绕过警告。

linux命令:svn add --force * * --force add svn svn add --force *rootopen.com
linux命令:svn add --force * * --force add svn svn add --force *rootopen.com
.

检查哪些文件不受版本控制,获取名称并通过“svn add”运行它们。警告:不适用于空格。

linux命令:svn status |grep '\?' |awk '{print $2}'| xargs svn add add svn xargs $2}'| '{print |awk '\?' |grep status svn svn status |grep '\?' |awk '{print $2}'| xargs svn addrootopen.com
linux命令:svn status |grep '\?' |awk '{print $2}'| xargs svn add add svn xargs $2}'| '{print |awk '\?' |grep status svn svn status |grep '\?' |awk '{print $2}'| xargs svn addrootopen.com
.

创建一个包含相对于Subversion存储库的本地更改的所有文件的tgz存档。添加'-q'选项以仅包含版本控制下的文件:svn st -q | cut -c 8- | sed's / ^ / \“/; s / $ / \”/'| xargs tar -czvf ../backup.tgz如果您无法提交,但希望为您的工作创建快速备份,请使用实用程序。当然,如果你发现自己需要它,这可能是你应该使用分支,补丁或分布式版本控制(git,mercurial等)的标志。

linux命令:svn st | cut -c 8- | sed 's/^/\"/;s/$/\"/' | xargs tar -czvf ../backup.tgz ../backup.tgz -czvf tar xargs | 's/^/\"/;s/$/\"/' sed | 8- -c cut | st svn svn st | cut -c 8- | sed 's/^/\"/;s/$/\"/' | xargs tar -czvf ../backup.tgzrootopen.com
linux命令:svn st | cut -c 8- | sed 's/^/\"/;s/$/\"/' | xargs tar -czvf ../backup.tgz ../backup.tgz -czvf tar xargs | 's/^/\"/;s/$/\"/' sed | 8- -c cut | st svn svn st | cut -c 8- | sed 's/^/\"/;s/$/\"/' | xargs tar -czvf ../backup.tgzrootopen.com
.

linux命令:svn st | grep "^\?" | awk "{print \$2}" | xargs svn add $1 $1 add svn xargs | \$2}" "{print awk | "^\?" grep | st svn svn st | grep "^\?" | awk "{print \$2}" | xargs svn add $1rootopen.com
linux命令:svn st | grep "^\?" | awk "{print \$2}" | xargs svn add $1 $1 add svn xargs | \$2}" "{print awk | "^\?" grep | st svn svn st | grep "^\?" | awk "{print \$2}" | xargs svn add $1rootopen.com
.

在本地工作副本中还原在特定修订版中所做的更改。您必须将本地副本提交到存储库以使其永久。这对于撤消更改非常有用。您可以通过指定更宽的数字来还原多个更改;只记得先把最高的数字。

linux命令:svn merge -r 1337:1336 PATH PATH PATH PATH 1337:1336 -r merge svn svn merge -r 1337:1336 PATH PATHrootopen.com
linux命令:svn merge -r 1337:1336 PATH PATH PATH PATH 1337:1336 -r merge svn svn merge -r 1337:1336 PATH PATHrootopen.com
.

得到颠覆差异输出而不会分散空白变化。当你清理代码时确保你没有改变任何重要的东西。使用旧代码或其他人的代码时也很有用。

linux命令:svn diff --diff-cmd diff -x -uw /path/to/file /path/to/file -uw -x diff --diff-cmd diff svn svn diff --diff-cmd diff -x -uw /path/to/filerootopen.com
linux命令:svn diff --diff-cmd diff -x -uw /path/to/file /path/to/file -uw -x diff --diff-cmd diff svn svn diff --diff-cmd diff -x -uw /path/to/filerootopen.com
.

linux命令:svn st | grep "^\?" | awk "{print \$2}" | xargs rm -rf -rf rm xargs | \$2}" "{print awk | "^\?" grep | st svn svn st | grep "^\?" | awk "{print \$2}" | xargs rm -rfrootopen.com
linux命令:svn st | grep "^\?" | awk "{print \$2}" | xargs rm -rf -rf rm xargs | \$2}" "{print awk | "^\?" grep | st svn svn st | grep "^\?" | awk "{print \$2}" | xargs rm -rfrootopen.com
.

linux命令:svn st | grep /main/java | awk '{print $2}' | xargs echo | xargs svn ci -m "my comment here" here" comment "my -m ci svn xargs | echo xargs | $2}' '{print awk | /main/java grep | st svn svn st | grep /main/java | awk '{print $2}' | xargs echo | xargs svn ci -m "my comment here"rootopen.com
linux命令:svn st | grep /main/java | awk '{print $2}' | xargs echo | xargs svn ci -m "my comment here" here" comment "my -m ci svn xargs | echo xargs | $2}' '{print awk | /main/java grep | st svn svn st | grep /main/java | awk '{print $2}' | xargs echo | xargs svn ci -m "my comment here"rootopen.com
.

使用此命令查找按提交频率排序的提交者列表。

linux命令:svn log -q|grep "|"|awk "{print \$3}"|sort|uniq -c|sort -nr -nr -c|sort \$3}"|sort|uniq "{print "|"|awk -q|grep log svn svn log -q|grep "|"|awk "{print \$3}"|sort|uniq -c|sort -nrrootopen.com
linux命令:svn log -q|grep "|"|awk "{print \$3}"|sort|uniq -c|sort -nr -nr -c|sort \$3}"|sort|uniq "{print "|"|awk -q|grep log svn svn log -q|grep "|"|awk "{print \$3}"|sort|uniq -c|sort -nrrootopen.com
.

我把它放在一个名为“svndiff”的shell脚本中,因为它提供了一个方便的装饰“svn diff”输出,它是彩色的(你在这里看不到)和分页。 -r是必需的,因此不会破坏颜色代码。

linux命令:svn diff $* | colordiff | less -r -r less | colordiff | $* diff svn svn diff $* | colordiff | less -rrootopen.com
linux命令:svn diff $* | colordiff | less -r -r less | colordiff | $* diff svn svn diff $* | colordiff | less -rrootopen.com
.

方便。

linux命令:svn st | grep ^\? | awk '{print $2}' | xargs svn add add svn xargs | $2}' '{print awk | ^\? grep | st svn svn st | grep ^\? | awk '{print $2}' | xargs svn addrootopen.com
linux命令:svn st | grep ^\? | awk '{print $2}' | xargs svn add add svn xargs | $2}' '{print awk | ^\? grep | st svn svn st | grep ^\? | awk '{print $2}' | xargs svn addrootopen.com
.

linux命令:svn st | grep ^? | xargs svn add 2> /dev/null /dev/null 2> add svn xargs | ^? grep | st svn svn st | grep ^? | xargs svn add 2> /dev/nullrootopen.com
linux命令:svn st | grep ^? | xargs svn add 2> /dev/null /dev/null 2> add svn xargs | ^? grep | st svn svn st | grep ^? | xargs svn add 2> /dev/nullrootopen.com
.

这些命令的一部分:svn status | grep'^ \?' =>在工作副本上找到新文件或目录-e's / ^ \?// g'=>在文件的第一个字符上删除“^”字符namexargs svn add =>将文件添加到subversion repository中可以修改上述命令其他细节,如恢复添加文件或已修改的提交文件。 ^ _ ^

linux命令:svn status | grep '^\?' | sed -e 's/^\?//g' | xargs svn add add svn xargs | 's/^\?//g' -e sed | '^\?' grep | status svn svn status | grep '^\?' | sed -e 's/^\?//g' | xargs svn addrootopen.com
linux命令:svn status | grep '^\?' | sed -e 's/^\?//g' | xargs svn add add svn xargs | 's/^\?//g' -e sed | '^\?' grep | status svn svn status | grep '^\?' | sed -e 's/^\?//g' | xargs svn addrootopen.com
.

linux命令:svn diff ARGUMENTS_FOR_DIFF | source-highlight --out-format=esc --src-lang=diff --src-lang=diff --out-format=esc source-highlight | ARGUMENTS_FOR_DIFF diff svn svn diff ARGUMENTS_FOR_DIFF | source-highlight --out-format=esc --src-lang=diffrootopen.com
linux命令:svn diff ARGUMENTS_FOR_DIFF | source-highlight --out-format=esc --src-lang=diff --src-lang=diff --out-format=esc source-highlight | ARGUMENTS_FOR_DIFF diff svn svn diff ARGUMENTS_FOR_DIFF | source-highlight --out-format=esc --src-lang=diffrootopen.com
.

从svn存储库中删除所有未版本控制的文件和文件夹。另外:svn status --no-ignore | grep ^ I | awk'{print $ 2}'| xargs rm -rf将删除那些svn状态忽略的文件。方便地添加到您的路径中的脚本,以便您可以从任何存储库(la'svn_clean.sh')运行它。

linux命令:svn status | grep ^? | awk '{print $2}' | xargs rm -rf -rf rm xargs | $2}' '{print awk | ^? grep | status svn svn status | grep ^? | awk '{print $2}' | xargs rm -rfrootopen.com
linux命令:svn status | grep ^? | awk '{print $2}' | xargs rm -rf -rf rm xargs | $2}' '{print awk | ^? grep | status svn svn status | grep ^? | awk '{print $2}' | xargs rm -rfrootopen.com
.

这会递增地将所有新文件添加到SVN。它不适用于名称中有空格的文件,但为什么要首先创建名称中有空格的文件?

linux命令:svn status | grep "^\?" | awk '{print $2}' | xargs svn add add svn xargs | $2}' '{print awk | "^\?" grep | status svn svn status | grep "^\?" | awk '{print $2}' | xargs svn addrootopen.com
linux命令:svn status | grep "^\?" | awk '{print $2}' | xargs svn add add svn xargs | $2}' '{print awk | "^\?" grep | status svn svn status | grep "^\?" | awk '{print $2}' | xargs svn addrootopen.com
.

在bash中运行命令后,!$被设置为命令的最后一个(空格分隔的)参数。非常适合针对同一个文件连续运行几个命令。

linux命令:svn status app/models/foo.rb; svn commit -m "Changed file" !$ !$ file" "Changed -m commit svn app/models/foo.rb; status svn svn status app/models/foo.rb; svn commit -m "Changed file" !$rootopen.com
linux命令:svn status app/models/foo.rb; svn commit -m "Changed file" !$ !$ file" "Changed -m commit svn app/models/foo.rb; status svn svn status app/models/foo.rb; svn commit -m "Changed file" !$rootopen.com
.

这对管道到其他命令也很有用:svn status | egrep'^(M | A)'| egrep -o'[^ MA \]。* $'| xargs $编辑器

linux命令:svn status | egrep '^(M|A)' | egrep -o '[^MA\ ].*$' ].*$' '[^MA\ -o egrep | '^(M|A)' egrep | status svn svn status | egrep '^(M|A)' | egrep -o '[^MA\ ].*$'rootopen.com
linux命令:svn status | egrep '^(M|A)' | egrep -o '[^MA\ ].*$' ].*$' '[^MA\ -o egrep | '^(M|A)' egrep | status svn svn status | egrep '^(M|A)' | egrep -o '[^MA\ ].*$'rootopen.com
.

如果(当)您忘记了存储库中的“svn rm”文件,请使用它让存储库知道您希望这些文件消失。当然,这也适用于添加和还原。

linux命令:svn rm `svn status | grep "\!" | cut -c 8-` 8-` -c cut | "\!" grep | status `svn rm svn svn rm `svn status | grep "\!" | cut -c 8-`rootopen.com
linux命令:svn rm `svn status | grep "\!" | cut -c 8-` 8-` -c cut | "\!" grep | status `svn rm svn svn rm `svn status | grep "\!" | cut -c 8-`rootopen.com
.
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

推荐
    热门命令