Diff for /wikisrc/users/dholland/mercurial.mdwn between versions 1.2 and 1.3

version 1.2, 2013/09/02 01:23:40 version 1.3, 2013/09/02 04:22:32
Line 107  But unless you're absolutely certain, do Line 107  But unless you're absolutely certain, do
 If you're going to be using a patch queue, now enable mq.  If you're going to be using a patch queue, now enable mq.
   
         % vi .hg/hgrc          % vi .hg/hgrc
   
 and add  and add
   
         [extensions]          [extensions]
         hgext.mq =          hgext.mq =
   
 (Since the extension is built into Mercurial, that's all you need.)  (Since the extension is built into Mercurial, that's all you need.)
 You can if you prefer also put this in your .hgrc so mq is always on.  You can if you prefer also put this in your .hgrc so mq is always on.
 Then do  Then do
         hg qinit -c  
           % hg qinit -c
   
 The -c option tells mq that you'll be checkpointing your patches,  The -c option tells mq that you'll be checkpointing your patches,
 which is usually a good idea.  which is usually a good idea.
   
Line 122  This file contains one regular expressio Line 127  This file contains one regular expressio
 files (and subdirectories) whose paths from the repository root match  files (and subdirectories) whose paths from the repository root match
 one of the regexps.  one of the regexps.
 Add at least:  Add at least:
   
         ^CVS$          ^CVS$
         /CVS$          /CVS$
   
 to ignore all the CVS control directories in the CVS checkout.  to ignore all the CVS control directories in the CVS checkout.
 While you can commit these to Mercurial, there's no point and it gets  While you can commit these to Mercurial, there's no point and it gets
 awkward if owing to mistakes later you end up having to merge them.  awkward if owing to mistakes later you end up having to merge them.
   
 If you aren't arranging to put the tree's object directories somewhere  If you aren't arranging to put the tree's object directories somewhere
 else, then also add  else, then also add
         ^obj\.[0-9a-z]$  
         /obj\.[0-9a-z]$          ^obj\.[0-9a-z]*$
           /obj\.[0-9a-z]*$
   
 and you might want  and you might want
   
         ^sys/arch/[0-9a-z]*/compile/[A-Z]          ^sys/arch/[0-9a-z]*/compile/[A-Z]
   
 to ignore kernel build directories.  to ignore kernel build directories.
   
 Ignore subtrees that you aren't working in.  Ignore subtrees that you aren't working in.
Line 165  Now add and commit the contents of the w Line 176  Now add and commit the contents of the w
   
         % hg add          % hg add
         % hg commit -m 'HEAD of 20130101'          % hg commit -m 'HEAD of 20130101'
   
 (or whatever date)  (or whatever date)
   
 You are now in business.  You are now in business.
Line 173  You are now in business. Line 185  You are now in business.
   
 If you're using a branch, remember to change branches before you  If you're using a branch, remember to change branches before you
 commit anything:  commit anything:
   
         % hg branch mystuff          % hg branch mystuff
   
 You want to keep the default branch an untouched CVS tree so you can  You want to keep the default branch an untouched CVS tree so you can
 use Mercurial to merge.  use Mercurial to merge.
 (And also so you can use Mercurial to extract diffs against CVS HEAD  (And also so you can use Mercurial to extract diffs against CVS HEAD
Line 190  Use hg commit or hg qrefresh to sync stu Line 204  Use hg commit or hg qrefresh to sync stu
 If you're using mq, it's a good idea to checkpoint your patch queue  If you're using mq, it's a good idea to checkpoint your patch queue
 periodically.  periodically.
 This is done as follows:  This is done as follows:
   
         % hg qcommit          % hg qcommit
   
 The patches directory (.hg/patches) is stored in its own Mercurial  The patches directory (.hg/patches) is stored in its own Mercurial
 repository, and this commits the patches to that repository.  repository, and this commits the patches to that repository.
 If necessary you can then fetch older versions of the patches back and  If necessary you can then fetch older versions of the patches back and
Line 207  own mq patch, even if you aren't using m Line 223  own mq patch, even if you aren't using m
   
 Now go back to a clean CVS tree.  Now go back to a clean CVS tree.
 If using branches, go back to the default branch:  If using branches, go back to the default branch:
   
         % hg update -r default          % hg update -r default
   
 If using mq, pop all the patches:  If using mq, pop all the patches:
   
         % hg qpop -a          % hg qpop -a
   
 DO NOT run cvs update until/unless you have done this; it will make a  DO NOT run cvs update until/unless you have done this; it will make a
Line 217  When you eventually do this by accident, Line 236  When you eventually do this by accident,
 recovering from mistakes.  recovering from mistakes.
   
 Now run cvs update from the top of the source tree:  Now run cvs update from the top of the source tree:
   
         % cvs -q update -dP          % cvs -q update -dP
   
 You should get no conflicts from CVS and nothing should show as  You should get no conflicts from CVS and nothing should show as
Line 225  modified. Line 245  modified.
 be able to check this.)  be able to check this.)
   
 Tell hg to sync up:  Tell hg to sync up:
   
         % hg addremove          % hg addremove
   
 Use hg to check what it thinks has changed:  Use hg to check what it thinks has changed:
   
         % hg status          % hg status
   
 Commit the changes to Mercurial:  Commit the changes to Mercurial:
   
         % hg commit -m 'Updated to 20130202"          % hg commit -m 'Updated to 20130202"
   
 Now you get to merge.  Now you get to merge.
   
 If you're using a branch, you want to merge the changes into your  If you're using a branch, you want to merge the changes into your
 branch rather than merge your branch into the changes:  branch rather than merge your branch into the changes:
   
         % hg update -r mystuff          % hg update -r mystuff
         % hg merge default          % hg merge default
         (edit and resolve as needed)          (edit and resolve as needed)
Line 268  Then: Line 292  Then:
   
 If you're using a branch, go back to the default branch and merge your  If you're using a branch, go back to the default branch and merge your
 changes into it:  changes into it:
   
         % hg update -r default          % hg update -r default
         % hg merge mystuff          % hg merge mystuff
         % hg commit -m "prepare to commit back to cvs"          % hg commit -m "prepare to commit back to cvs"
   
 Now cvs add any new directories and files; be sure not to forget this.  Now cvs add any new directories and files; be sure not to forget this.
 It is a good idea to crosscheck with cvs diff and/or cvs update:  It is a good idea to crosscheck with cvs diff and/or cvs update:
   
         % cvs diff -up | less          % cvs diff -up | less
         % cvs -nq update -dP          % cvs -nq update -dP
   
 Then you can cvs commit:  Then you can cvs commit:
   
         % cvs commit          % cvs commit
   
 Because of RCSIDs, committing into cvs changes the source files.  Because of RCSIDs, committing into cvs changes the source files.
 So now you need to do:  So now you need to do:
   
         % hg commit -m 'cvs committed'          % hg commit -m 'cvs committed'
   
 and if you intend to keep working in this tree, you want to merge that  and if you intend to keep working in this tree, you want to merge that
 changeset back into your branch to avoid having it cause merge  changeset back into your branch to avoid having it cause merge
 conflicts later.  conflicts later.
Line 289  Do that as above. Line 321  Do that as above.
 If you're using a patch queue, usually it's because you want to commit  If you're using a patch queue, usually it's because you want to commit
 each patch back to CVS individually.  each patch back to CVS individually.
 First pop all the patches:  First pop all the patches:
   
         % hg qpop -a          % hg qpop -a
   
 Now, for each patch:  Now, for each patch:
   
         % hg qpush          % hg qpush
         % hg qfinish -a          % hg qfinish -a
         % cvs commit          % cvs commit
         % hg commit -m "cvs committed previous"          % hg commit -m "cvs committed previous"
   
 With a long patch queue, you'll want to use the patch comments as the  With a long patch queue, you'll want to use the patch comments as the
 CVS commit messages.  CVS commit messages.
 Also, running cvs commit from the top for every patch is horribly slow.  Also, running cvs commit from the top for every patch is horribly slow.
 Both these problems can be fixed by putting the following in a script:  Both these problems can be fixed by putting the following in a script:
   
         hg log -v -r. | sed '1,/^description:$/d' > patch-message          hg log -v -r. | sed '1,/^description:$/d' > patch-message
         cat patch-message          cat patch-message
         echo -n 'cvs commit -F patch-message '          echo -n 'cvs commit -F patch-message '
         hg log -v -r. | grep '^files:' | sed 's/^files://'          hg log -v -r. | grep '^files:' | sed 's/^files://'
   
 (I call this "dogetpatch.sh") and then the procedure is:  (I call this "dogetpatch.sh") and then the procedure is:
   
         % hg qpop -a          % hg qpop -a
   
 then for each patch:  then for each patch:
   
         % hg qpush && hg qfinish -a && dogetpatch.sh          % hg qpush && hg qfinish -a && dogetpatch.sh
         % cvs commit [as directed]          % cvs commit [as directed]
         % hg commit -m "cvs committed previous"          % hg commit -m "cvs committed previous"
   
 (This could be automated further but doing so seems unwise.)  (This could be automated further but doing so seems unwise.)
   
 ### Using CVS within Mercurial  ### Using CVS within Mercurial
Line 356  the tree it knows about, then go back to Line 398  the tree it knows about, then go back to
 and update properly.  and update properly.
   
 If you're using a branch:  If you're using a branch:
   
         % hg revert -C          % hg revert -C
         % hg update -r default          % hg update -r default
   
 If you're using a patch queue:  If you're using a patch queue:
   
         % hg revert -C          % hg revert -C
         % hg qpop -a          % hg qpop -a
   
Line 388  to any intermediate state; and then you  Line 433  to any intermediate state; and then you 
 insert a new patch, or whatever.  insert a new patch, or whatever.
   
 To see the list of patches:  To see the list of patches:
   
         % hg qseries          % hg qseries
   
 To apply the next patch:  To apply the next patch:
   
         % hg qpush          % hg qpush
   
 To remove the current patch:  To remove the current patch:
   
         % hg qpop          % hg qpop
   
 To merge current working tree changes into the current patch:  To merge current working tree changes into the current patch:
   
         % hg qrefresh          % hg qrefresh
   
 To also update the current patch's change comment:  To also update the current patch's change comment:
   
         % hg qrefresh -e          % hg qrefresh -e
   
 To collect current working tree changes (if any) into a new patch:  To collect current working tree changes (if any) into a new patch:
   
         % hg qnew PATCHNAME           % hg qnew PATCHNAME 
   
 When there's an mq patch applied, you can't commit.  When there's an mq patch applied, you can't commit.

Removed from v.1.2  
changed lines
  Added in v.1.3


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb