我正在使用一个庞大的SVN存储库 - 它由数百个目录(所有不同深度)和数千个文件(所有不同类型)组成。我需要对此repo中包含的几百个JavaScript文件进行批量更新。我没有下载整个仓库,而是希望有选择地只检查.js文件。我一直在玩一堆不同的方法,但是还没有能够破解它。这就是我能想到的......
# CHECKOUT INITIAL WORKING COPY
svn co https://myrepo.com/site-content --depth empty
# NAVIGATE TO WORKING COPY
cd site-content
# CHECKOUT FULL DIRECTORY TREE
env REPO=https://myrepo.com/site-content sh -c 'svn ls -R $REPO | grep "/\$" | xargs -n 1 svn co --depth empty $REPO'
# UPDATE WORKING COPY WITH .JS FILES
svn up `svn ls -R https://myrepo.com/site-content | grep .js$`
我回到终端的回复似乎表明一切正常,但事实并非如此。我留下了完整的目录树,但绝对没有.js文件。这是我的终端输出样本:
jakes-mac:working-copy jake$ svn co https://myrepo.com/site-content --depth empty
Checked out revision 21097.
jakes-mac:working-copy jake$ cd site-content
jakes-mac:site-content jake$ env REPO=https://myrepo.com/site-content sh -c 'svn ls -R $REPO | grep "/\$" | xargs -n 1 svn co --depth empty $REPO'
Checked out revision 21098.
Checked out revision 21098.
Checked out revision 21098.
Checked out revision 21098.
Checked out revision 21098.
...
Checked out revision 21099.
Checked out revision 21099.
Checked out revision 21099.
Checked out revision 21099.
Checked out revision 21099.
jakes-mac:site-content jake$ svn up `svn ls -R https://myrepo.com/site-content | grep .js$`
Updating '2013/js/_old/script.trees.bak.rev-a.js':
At revision 21100.
Updating '2013/js/_old/script.video.bak.rev-a.js':
At revision 21100.
Updating '2013/js/script.category.js':
At revision 21100.
Updating '2013/js/script.trees.js':
At revision 21100.
Updating '2013/js/script.video-v2.js':
At revision 21100.
Updating '2013/js/script.video.js':
At revision 21100.
Updating '2014/TreeGiveaway/js/script.sweeps.js':
At revision 21100.
Updating '2014/TreeGiveaway/js/validate-voting.js':
At revision 21100.
Updating '2014/js/collectionslider.js':
At revision 21100.
Updating '2014/js/difference.js':
At revision 21100.
Updating '2014/js/mobile.js':
At revision 21100.
Updating '2014/js/script.category.js':
At revision 21100.
Updating '2014/js/script.quicklight_inset.js':
At revision 21100.
Updating '2014/js/script.trees.js':
At revision 21100.
Updating '2014/js/script.trees.v3.js':
At revision 21100.
Updating '2014/js/script.trees_inset.js':
At revision 21100.
Updating '2014/js/script.trees_inset.new.js':
At revision 21100.
Updating '2014/slideshow/js/jquery.easing.min.js':
At revision 21100.
Updating '2014/slideshow/js/script.js':
At revision 21100.
Updating '2014/slideshow/js/supersized.3.2.7.js':
At revision 21100.
Updating '2014/slideshow/js/supersized.shutter.js':
At revision 21100.
Updating '2015/js/framework.fetchFeed.js':
At revision 21100.
Updating '2015/js/framework.goModal.js':
At revision 21100.
Updating '2015/js/frameworkForMobile.js':
At revision 21100.
Updating '2015/js/script.category.js':
At revision 21100.
Updating '2015/js/script.hs.js':
At revision 21100.
Updating '2015/js/script.shop-the-scene.js':
At revision 21100.
Updating '2015/js/script.trees.js':
At revision 21100.
Updating '2015/tree-finder/results.script-v2.js':
At revision 21100.
Updating '2015/tree-finder/results.script.js':
At revision 21100.
Updating '2015/tree-finder/wizard.script.js':
At revision 21100.
Updating 'current/js/holiday-decor.js':
At revision 21100.
Updating 'current/js/how-to.js':
At revision 21100.
Updating 'current/js/shop-the-style.js':
At revision 21100.
编辑:
现在全部工作!最终命令列表:
# CHECKOUT INITIAL WORKING COPY
svn co https://myrepo.com/site-content --depth empty
# NAVIGATE TO WORKING COPY
cd site-content
# CHECKOUT FULL DIRECTORY TREE
env REPO=https://myrepo.com/site-content sh -c 'svn ls -R $REPO | grep "/\$" | while read dir; do svn co --depth=empty $REPO/$dir $dir; done'
# UPDATE WORKING COPY WITH .JS FILES
svn up `svn ls -R https://myrepo.com/site-content | grep .js$`
# COMMIT ALL CHANGES TO REPO
svn commit `svn ls -R | grep .js$` -m "Bulk Updating Content"
答案 0 :(得分:1)
使用您的" CHECKOUT FULL DIRECTORY TREE"命令您在所有目录中重新检查了存储库根目录。
yyyy-mm-dd HH:00
参见例如env REPO=https://myrepo.com/site-content sh -c 'svn ls -R $REPO | \
grep "/\$" | xargs -n 1 svn co --depth empty $REPO'
^^^^^
" ...似乎表明一切正常," - 这不是真的,因为没有人看到像这样的线
svn info 2014/js/
例如
A <filename>
尝试这样的事情:
Updating '2014/js/script.trees.v3.js':
A 2014/js/script.trees.v3.js