Something that was not obvious (to me) in the hgsubversion documentation is that you can clone any part of a subversion repository.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
#!/bin/bash # # With hgsubversion, you can clone *ANY* folder in a subversion repository. # (Well, really any non-empty folder) # Let me repeat, you do not have to clone the entire repository! It could be # a branch or even a folder within a branch. If you clone a branch folder, # your pushed changesets will go into the branch. # # Requires: # subversion installed # rebase extension # hgsubversion extension # # We have the following repositories: # SVN repo hg-svn # # SVN repo: company subversion repo on remote server, https://ip/svn # hg-svn: local developer copy of SVN repo using hgsubversion # # Our goal is to clone/checkout only a sub-folder, make changes, and see # what happens. # # Example: # Turn on debugging so we can see the commands as they're issued. set -x # Clean up after any previous run. rm -rf folder_test mkdir folder_test cd folder_test # Create a "company" SVN repository. svnadmin create SVN svn co file://`pwd`/SVN SVN_temp # Put something in the SVN repository or we won't be able # to see why some of the steps are necessary. cd SVN_temp/ svn mkdir trunk tags branches svn ci -m "Initial folders" echo "Company file" > trunk/company.txt svn add trunk/company.txt svn mkdir trunk/subfolder echo "text" >> trunk/subfolder/anotherfile.txt svn add trunk/subfolder/anotherfile.txt svn ci -m "Added some files" cd .. # Create our clone of SVN. Just grab the folder you want. It could be # a branch or even a folder in a branch. hg clone file://`pwd`/SVN/trunk/subfolder hg-svn # Make some changes cd hg-svn echo "more text" >> anotherfile.txt echo "text" >> newfile.txt hg add newfile.txt hg com -m "Made some change in hg." hg push cd .. # Look at the complete subversion repository to see what happened. cd SVN_temp svn up # See that out line was added. cat trunk/subfolder/anotherfile.txt # See the new file. set +x echo "==========================" echo "Results:" find . | egrep -v '\.svn' cd .. # Use the following command to see the log of changes: # svn log -v SVN_temp |