hg pull -u -r rev bug?

John Coomes John.Coomes at sun.com
Tue Oct 20 23:28:12 UTC 2009


The help for pull says

 -u --update     update to new tip if changesets were pulled

However, "hg pull -u -r rev" updates the working dir to rev, not tip.

Is the help incomplete, or the behavior wrong?

If rev is a rev number (e.g., -r 100) that existed in the destination
repo before the pull, the result is confusing.  Example:

$ hg init a
$ echo 1 > a/1
$ hg -R a ci -Am 'a.1'
adding 1
$ hg clone a b
updating working directory
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo 2 > a/2        
$ hg -R a ci -Am 'a.2'
adding 2
$ echo 3 > a/3        
$ hg -R a ci -Am 'a.3'
adding 3
$ echo 4 > b/4        
$ hg -R b ci -Am 'b.4'
adding 4
$ echo 5 > b/5        
$ hg -R b ci -Am 'b.5'
adding 5
$ hg -R a log     
changeset:   2:145fd7005c05
tag:         tip
user:        jcoomes
date:        Tue Oct 20 15:34:10 2009 -0700
summary:     a.3

changeset:   1:21f600def533
user:        jcoomes
date:        Tue Oct 20 15:34:00 2009 -0700
summary:     a.2

changeset:   0:07fcf664d9ca
user:        jcoomes
date:        Tue Oct 20 15:33:15 2009 -0700
summary:     a.1

$ hg -R b log
changeset:   2:fd416fdbf8fe
tag:         tip
user:        jcoomes
date:        Tue Oct 20 15:34:59 2009 -0700
summary:     b.5

changeset:   1:efa666e198dc
user:        jcoomes
date:        Tue Oct 20 15:34:45 2009 -0700
summary:     b.4

changeset:   0:07fcf664d9ca
user:        jcoomes
date:        Tue Oct 20 15:33:15 2009 -0700
summary:     a.1

$ hg -R a pull -u -r 1 b
pulling from b
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg -R a parents       
changeset:   1:21f600def533
user:        jcoomes
date:        Tue Oct 20 15:34:00 2009 -0700
summary:     a.2
$ hg version
Mercurial Distributed SCM (version 1.3.1)


In this case, the working dir parent is not tip, and not even a head.

-John




More information about the Mercurial-devel mailing list