Changes between Version 20 and Version 21 of DarcsEvaluation


Ignore:
Timestamp:
Jul 23, 2008 11:48:11 PM (6 years ago)
Author:
batterseapower
Comment:

Add mercurial workflows

Legend:

Unmodified
Added
Removed
Modified
  • DarcsEvaluation

    v20 v21  
    108108}}} 
    109109 
     110Mercurial: 
     111{{{ 
     112# Make a repo with a single file with lines 1,3,5,7 in 
     113 
     114mkdir repo1 
     115cd repo1 
     116hg init 
     117printf 'Line1\nLine3\nLine5\nLine7\n' > file 
     118hg commit --addremove -m patch1 -u igloo@earth.li 
     119cd .. 
     120 
     121# Check out 2 copies of the repo 
     122 
     123hg clone repo1 repo2 
     124hg clone repo1 repo3 
     125 
     126# Add a patch that adds lines 2 and 6, then another that adds line 4 
     127 
     128cd repo1 
     129printf 'Line1\nLine2\nLine3\nLine5\nLine6\nLine7\n' > file 
     130hg commit -m patch2 
     131printf 'Line1\nLine2\nLine3\nLine4\nLine5\nLine6\nLine7\n' > file 
     132hg commit -m patch3 
     133 
     134# Pull the line 4 patch, but not the lines 2 and 6 patch, into the 
     135# other repos non-interactively and interactively 
     136 
     137cd ../repo2 
     138# Don't know how to do this: darcs pull --all --patches patch3 
     139cd ../repo3 
     140hg transplant --source ../repo1 
     141# It doesn't appear to be possible to omit the source argument for transplant, 
     142# though you can omit it from the non-cherrypicking hg pull 
     143n 
     144y 
     145 
     146# repo2's and repo3's file now contains lines 1,3,4,5,7 
     147}}} 
     148 
    110149=== Cherry-picking during record === 
    111150 
     
    165204}}} 
    166205 
     206Mercurial: 
     207{{{ 
     208# Make a repo with a single file with lines 1,3,5,7,9 in 
     209 
     210mkdir repo1 
     211cd repo1 
     212hg init 
     213printf 'Line1\nLine3\nLine5\nLine7\nLine9\n' > file 
     214hg commit --addremove -m patch1 -u igloo@earth.li 
     215 
     216# Now we fix a bug, and in the process add some debugging prints. 
     217 
     218printf 'Line1\nFix2\nLine3\nDebug4\nLine5\nFix6\nLine7\nDebug8\nLine9\n' > file 
     219 
     220# We want to record our fix, but not the debugging prints. 
     221 
     222hg record -m the_fix 
     223# Annoyingly you have to press enter after each of these characters. Darcs does not require this. 
     224# Perhaps it's configurable? 
     225Y 
     226y 
     227n 
     228y 
     229n 
     230 
     231# Get rid of the debug prints 
     232 
     233hg revert -a 
     234 
     235# Now file contains lines 1,2,3,5,6,7,9 
     236}}} 
     237 
    167238=== amend-record === 
    168239 
     
    170241 
    171242The same is available for Git.  The command is called {{{git commit --amend}}}.  You usually checkout the commit you want to edit into a branch, do the changes, then rebase the remaining patches on top of this.  Example coming soon... 
     243 
     244I can't find a way to do this directly with Mercurial. You can of course do {{{hg rollback}}} and then add a new commit, however. 
    172245 
    173246== Darcs alternatives still in the running ==