Diff for /wikisrc/users/dholland/hgnb.mdwn between versions 1.5 and 1.12

version 1.5, 2014/12/14 02:59:39 version 1.12, 2014/12/14 09:52:59
Line 26  somewhere that constitutes the master co Line 26  somewhere that constitutes the master co
   
 Therefore, the basic usage is almost entirely unchanged:  Therefore, the basic usage is almost entirely unchanged:
   
  CVS                            Mercurial      CVS                                 Mercurial
   
  cvs checkout                   hg clone      cvs checkout                        hg clone
  cvs update -dP                 hg pull && hg update      cvs update -dP                      hg pull && hg update
  cvs -n update                  hg status      cvs -n update                       hg status
  cvs log file                   hg log file  [or just hg log]      cvs log file                        hg log file  [or just hg log]
   
  cvs update -p file             hg cat file      cvs update -p file                  hg cat file
  cvs annotate                   hg annotate      cvs annotate                        hg annotate
  cvs diff -u                    hg diff      cvs diff -u                         hg diff
  cvs add                        hg add      cvs add                             hg add
  cvs rm                         hg rm      cvs rm                              hg rm
  [no can do]                    hg cp      [no can do]                         hg cp
  [no can do]                    hg mv      [no can do]                         hg mv
  cvs commit                     hg commit && hg push      cvs commit                          hg commit && hg push
  cvs tag                        hg tag      cvs tag                             hg tag
   
 You will notice that CVS's update and commit have been divided into  You will notice that CVS's update and commit have been divided into
 two now-separable actions: in Mercurial, pull fetches changes from a  two now-separable actions: in Mercurial, pull fetches changes from a
Line 65  committed, you need to do an explicit me Line 65  committed, you need to do an explicit me
 push.  push.
   
 In the simple case, you do an explicit merge as follows:  In the simple case, you do an explicit merge as follows:
                                 hg pull  
                                 hg merge                                          hg pull
                                 hg commit                                          hg merge
                                           hg commit
   
 When you get a merge conflict, you first need to resolve it (in the  When you get a merge conflict, you first need to resolve it (in the
 usual way by editing) and then you must tag it resolved in hg before  usual way by editing) and then you must tag it resolved in hg before
 hg will let you commit, like this:  hg will let you commit, like this:
                                 hg resolve -m file  
                                           hg resolve -m file
   
 You can list unresolved conflicts thus:  You can list unresolved conflicts thus:
                                 hg resolve -l  
                                           hg resolve -l
   
 Note that even with the explicit merge this is almost exactly  Note that even with the explicit merge this is almost exactly
 equivalent to the CVS behavior when someone commits ahead of you.  equivalent to the CVS behavior when someone commits ahead of you.
Line 86  that touches the same files you've edite Line 89  that touches the same files you've edite
 There is one gotcha, which is that you can't do explicit merges in a  There is one gotcha, which is that you can't do explicit merges in a
 tree with uncommitted changes. The best way around this is to stash  tree with uncommitted changes. The best way around this is to stash
 your changes:  your changes:
                                 hg stash  
                                 hg merge                                          hg stash
                                 ...whatever merge stuff...                                          hg merge
                                 hg unstash                                          ...whatever merge stuff...
                                           hg unstash
   
 You can also do the merge in another tree; because Mercurial is a  You can also do the merge in another tree; because Mercurial is a
 distributed tool, you can create a temporary copy of your tree, or  distributed tool, you can create a temporary copy of your tree, or
Line 99  trees, "src" and "scratch", where you ne Line 103  trees, "src" and "scratch", where you ne
 in "scratch" so it can be used for this kind of thing. Then you can do  in "scratch" so it can be used for this kind of thing. Then you can do
 the following (starting at the top of src):  the following (starting at the top of src):
   
                                 hg push ../scratch                                          hg push ../scratch
                                 cd ../scratch                                          cd ../scratch
                                 hg update                                          hg update
                                 hg merge                                          hg merge
                                 ...whatever merge stuff, including commit...                                          ...whatever merge stuff, including commit...
                                 cd ../src                                          cd ../src
                                 hg pull ../scratch                                          hg pull ../scratch
                                 hg update                                          hg update
   
 ### Disconnected operation  ### Disconnected operation
   
Line 122  push, pull, incoming, and outgoing. Line 126  push, pull, incoming, and outgoing.
 A commit with no descendents (that is, the most recent commit on any  A commit with no descendents (that is, the most recent commit on any
 line of development) is called a "head".  line of development) is called a "head".
 You can list these as follows:  You can list these as follows:
                                 hg heads  
                                           hg heads
   
 This will include commits that have descendents only on other  This will include commits that have descendents only on other
 branches, e.g. the last commit on a development branch that's been  branches, e.g. the last commit on a development branch that's been
Line 134  incoming" and "hg outgoing" respectively Line 139  incoming" and "hg outgoing" respectively
   
 If you interrupt Mercurial (or Mercurial gets interrupted, e.g. by a  If you interrupt Mercurial (or Mercurial gets interrupted, e.g. by a
 system crash) you want to do this afterwards:  system crash) you want to do this afterwards:
                                 hg recover  
                                           hg recover
   
 and if you have reason to think the repository might be corrupt you  and if you have reason to think the repository might be corrupt you
 can check it like this:  can check it like this:
                                 hg verify  
                                           hg verify
   
 ### Development branches  ### Development branches
   
Line 159  changes before they're done, go ahead an Line 166  changes before they're done, go ahead an
   
 Create a new branch:  Create a new branch:
   
         cvs update -dP          hg pull && hg update    (if needed)      cvs update -dP                      hg pull && hg update            (if needed)
         update doc/BRANCHES     update doc/BRANCHES     (if appropriate)      update doc/BRANCHES                 update doc/BRANCHES             (if appropriate)
         cvs commit doc/BRANCHES hg commit doc/BRANCHES  (if needed)      cvs commit doc/BRANCHES             hg commit doc/BRANCHES          (if needed)
         cvs tag libc13-base     hg tag libc13-base      cvs tag libc13-base                 hg tag libc13-base
         cvs ph'tagn             hg branch libc13      cvs ph'tagn                         hg branch libc13
         [make first change]     [make first change]      [make first change]                 [make first change]
         cvs commit              hg commit      cvs commit                          hg commit
                                 hg push                                          hg push
   
 Mercurial warns you that branches are permanent and expensive; this  Mercurial warns you that branches are permanent and expensive; this
 warning is aimed at git users who ought to be creating bookmarks  warning is aimed at git users who ought to be creating bookmarks
 instead and not something you need to be concerned about.  instead and not something you need to be concerned about.
   
 Check out a new tree on a branch:  Check out a new tree on a branch:
         cvs co -P -rlibc13      hg clone [url]  
                                 cd src      cvs co -P -rlibc13                  hg clone [url]
                                 hg update -r libc13                                          cd src
                                           hg update -r libc13
   
 Switch to a new tree on a branch:  Switch to a new tree on a branch:
         cvs up -dP -A -rlibc13  hg pull                 (if needed)  
                                 hg update -r libc13      cvs up -dP -A -rlibc13              hg pull                         (if needed)
                                           hg update -r libc13
   
 Note that if you have uncommitted changes, Mercurial will balk at  Note that if you have uncommitted changes, Mercurial will balk at
 crossing from one branch to another because it doesn't know how to  crossing from one branch to another because it doesn't know how to
 merge them.  merge them.
 In that case do this:  In that case do this:
                                 hg update -r libc13-base  
                                 [resolve conflicts if needed]                                          hg update -r libc13-base
                                 hg update -r libc13                                          [resolve conflicts if needed]
                                 [resolve conflicts if needed]                                          hg update -r libc13
                                           [resolve conflicts if needed]
   
 Check which branch you're currently on:  Check which branch you're currently on:
   
         cat CVS/Tag             hg branch      cat CVS/Tag                         hg branch
   
 See list of branches:  See list of branches:
         [no can do reliably]    hg branches       
       [no can do reliably]                hg branches     
   
 Note that unlike with CVS there's no version-control-related reason to  Note that unlike with CVS there's no version-control-related reason to
 get a new tree just to work on a branch.  get a new tree just to work on a branch.
Line 206  administrative reasons. Line 217  administrative reasons.
   
 Sync your branch with the trunk ("HEAD" in CVS):  Sync your branch with the trunk ("HEAD" in CVS):
   
         cvs ph'tagn             hg merge default      cvs ph'tagn                         hg merge default
         [resolve conflicts]     [resolve conflicts]      [resolve conflicts]                 [resolve conflicts]
         cvs commit              hg commit      cvs commit                          hg commit
                                 hg push                                          hg push
   
 When you're done with your branch, in Mercurial you can "close" it so  When you're done with your branch, in Mercurial you can "close" it so
 it's no longer active.  it's no longer active.
 This causes it to disappear from some reports, reduces some internal  This causes it to disappear from some reports, reduces some internal
 management overheads, and prevents accidental commits on it.  management overheads, and prevents accidental commits on it.
   
         [no can do]             hg commit --close-branch      [no can do]                         hg commit --close-branch
   
 Don't forget to update doc/BRANCHES too.  Don't forget to update doc/BRANCHES too.
   
Line 232  empty revision so it doesn't contain any Line 243  empty revision so it doesn't contain any
 To start a new vendor branch for the upstream package "frobozz",  To start a new vendor branch for the upstream package "frobozz",
 assuming you've already written frobozz2netbsd if one's needed:  assuming you've already written frobozz2netbsd if one's needed:
   
         mkdir tmp      mkdir tmp
         cd tmp      cd tmp
                                 hg update -r0000                                          hg update -r0000
                                 mkdir external && cd external                                          mkdir external && cd external
                                 mkdir bsd && cd bsd                                          mkdir bsd && cd bsd
                                 mkdir frobozz && cd frobozz                                          mkdir frobozz && cd frobozz
         tar -xvzf \             tar -xvzf \      tar -xvzf frobozz-1.0.tgz           tar -xvzf frobozz-1.0.tgz
           frobozz-1.0.tgz         frobozz-1.0.tgz      mv frobozz-1.0 dist                 mv frobozz-1.0 dist
         mv frobozz-1.0 dist     mv frobozz-1.0 dist      cp .../frobozz2netbsd .             cp .../frobozz2netbsd .
         cp .../frobozz2netbsd . cp .../frobozz2netbsd .      ./frobozz2netbsd                    ./frobozz2netbsd                (if needed)
         ./frobozz2netbsd        ./frobozz2netbsd        (if needed)      cvs import src/distrib/bsd/frobozz \
         cvs import \        FROBOZZ frobozz-1-0
           src/distrib/bsd/frobozz \                                          hg add
           FROBOZZ frobozz-1-0                                          hg branch FROBOZZ
                                 hg add                                          hg commit
                                 hg branch FROBOZZ                                          hg tag frobozz-1-0
                                 hg commit      cd ../src
                                 hg tag frobozz-1-0      cvs update -dP
         cd ../src                                          hg update -r default
         cvs update -dP                                          hg merge FROBOZZ
                                 hg update -r default                                          hg commit
                                 hg merge FROBOZZ      [hack as needed]                    [hack as needed]
                                 hg commit      cvs commit                          hg commit
         [hack as needed]        [hack as needed]                                          hg push
         cvs commit              hg commit      cd ..
                                 hg push      rm -r tmp
         cd ..  
         rm -r tmp  
   
 Note that in both cases this imports frobozz2netbsd on the branch;  Note that in both cases this imports frobozz2netbsd on the branch;
 this seems the most convenient but I'm not sure if it's been our  this seems the most convenient but I'm not sure if it's been our
Line 267  standard procedure. Line 276  standard procedure.
   
 To update "frobozz" to 1.1:  To update "frobozz" to 1.1:
   
         mkdir tmp      mkdir tmp
         cd tmp      cd tmp
                                 hg update -rFROBOZZ                                          hg update -rFROBOZZ
                                 cd external/bsd/frobozz                                          cd external/bsd/frobozz
         tar -xvzf \             tar -xvzf \      tar -xvzf frobozz-1.1.tgz           tar -xvzf frobozz-1.1.tgz
           frobozz-1.1.tgz         frobozz-1.1.tgz                                          rm -r dist
                                 rm -r dist      mv frobozz-1.1 dist                 mv frobozz-1.1 dist
         mv frobozz-1.1 dist     mv frobozz-1.1 dist      ./frobozz2netbsd                    ./frobozz2netbsd
         ./frobozz2netbsd        ./frobozz2netbsd      cvs import src/distrib/bsd/frobozz \
         cvs import \        FROBOZZ frobozz-1-0
           src/distrib/bsd/frobozz \                                          hg addremove
           FROBOZZ frobozz-1-0                                          hg commit
                                 hg addremove                                          hg tag frobozz-1-1
                                 hg commit      cd ..
                                 hg tag frobozz-1-1      mkdir tmp2 && cd tmp2
         cd ..      cvs ph'tagn
         mkdir tmp2 && cd tmp2                                          hg update -r default
         cvs ph'tagn                                          hg merge FROBOZZ
                                 hg update -r default      [resolve conflicts]                 [resolve conflicts]
                                 hg merge FROBOZZ      cvs commit                          hg commit
         [resolve conflicts]     [resolve conflicts]      cd ../src
         cvs commit              hg commit      cvs update -dP
         cd ../src      [hack as needed]                    [hack as needed]
         cvs update -dP      cvs commit                          hg commit
         [hack as needed]        [hack as needed]                                          hg push
         cvs commit              hg commit      cd ..
                                 hg push      rm -r tmp tmp2
         cd ..  
         rm -r tmp tmp2  
   
 ### Release branches  ### Release branches
   
Line 316  without looking it up. Line 323  without looking it up.
   
 Tagging a release:  Tagging a release:
   
         cvs rtag -r netbsd-7 \  hg tag -r netbsd-7 \      cvs rtag -r netbsd-7 \              hg tag -r netbsd-7 \
           netbsd-7-0-RELEASE      netbsd-7-0-RELEASE        netbsd-7-0-RELEASE                  netbsd-7-0-RELEASE
   
 Viewing the changes on a branch:  Viewing the changes on a branch:
   
         cvs log > file          hg log -b netbsd-7      cvs log > file                      hg log -b netbsd-7
         [page through & curse]      [page through and curse]
   
 Extracting tarballs:  Extracting tarballs:
   
                                 cd src      mkdir tmp
         hg export -r \          hg archive -r \      cd tmp
           netbsd-7-0-RELEASE \    netbsd-7-0-RELEASE \      cvs export -r netbsd-7-0-RELEASE \  hg archive -r netbsd-7-0-RELEASE \
           src                     .../netbsd-7.0.tar.gz        src                                 ../netbsd-7.0.tar.gz
         mv src netbsd-7.0      mv src netbsd-7.0
         tar -cvzf \      tar -cvzf ../netbsd-7.0.tar.gz \
           netbsd-7.0.tar.gz \        netbsd-7.0
           netbsd-7.0      cd ..
       rm -r tmp
   
   
 ### Reverting a bad commit  ### Reverting a bad commit
   
Line 343  separately, then commit them all. Line 352  separately, then commit them all.
 In Mercurial, because Mercurial has whole-tree commits, you can do it  In Mercurial, because Mercurial has whole-tree commits, you can do it
 with a single command.  with a single command.
   
         cvs update -j1.6 -j1.5 foo.c      cvs update -j1.6 -j1.5 foo.c
         cvs update -j1.9 -j1.8 bar.c      cvs update -j1.9 -j1.8 bar.c
         cvs update -j1.15 -j1.14 baz.c      cvs update -j1.15 -j1.14 baz.c
                                 hg backout -r 101abcde                                          hg backout -r 101abcde
         [resolve conflicts]     [resolve conflicts]      [resolve conflicts]                 [resolve conflicts]
         cvs commit              hg commit      cvs commit                          hg commit
                                 hg push                                          hg push
   
 Note that apparently if you use hg backout to back out the most recent  Note that apparently if you use hg backout to back out the most recent
 commit, it auto-commits.  commit, it auto-commits.
Line 404  local modification until whatever issue  Line 413  local modification until whatever issue 
 sorted out.  sorted out.
   
 To revert to a specific version:  To revert to a specific version:
                                 hg revert -r rev subtree  
                                           hg revert -r rev subtree
 To revert to a specific date:  To revert to a specific date:
                                 hg revert -d date subtree  
                                           hg revert -d date subtree
   
   
 ### Other stuff  ### Other stuff

Removed from v.1.5  
changed lines
  Added in v.1.12


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