Help text for pull's '--update' option is wrong

Steve Losh steve at stevelosh.com
Thu Jul 16 03:36:59 CDT 2009


On Jul 16, 2009, at 4:14 AM, Mads Kiilerich wrote:

> On 07/16/2009 09:26 AM, Steve Losh wrote:
>> Running `hg help pull` prints the following help about the update
>> option:
>>
>>   -u --update     update to new tip if changesets were pulled
>>
>> This doesn't match the actual behavior.  Running `hg pull -u` will
>> always attempt to update, even if no changesets were pulled.  To test
>> this you can update to a previous revision and run a pull with  
>> nothing
>> new in the destination repo -- your working directory will still be
>> updated to tip (or fail if it crosses branches, etc).
>>
>
> I can't reproduce the behavior you describe. And everybody else  
> complains that it works exactly as documented. MPM mentioned on IRC  
> 12 hours ago that he considered adding an option for doing what you  
> describe.
>
> Can you show a script to reproduce the behaviour? Or at least the  
> exact console output? "hg --version"?
>
> /Mads

Sure, here's a sample of the console output:

sjl at ecgtheow in ~
$ hg --version
Mercurial Distributed SCM (version 1.3)

Copyright (C) 2005-2009 Matt Mackall <mpm at selenic.com> and others
This is free software; see the source for copying conditions. There is  
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR  
PURPOSE.

sjl at ecgtheow in ~
$ j desk

sjl at ecgtheow in ~/Desktop
$ hg init test && cd test && touch a && hg com -Am 'initial'
adding a

sjl at ecgtheow in ~/Desktop/newtest on default
$ hg glog
@  changeset:   0:5126e88e844d
    summary:     initial


sjl at ecgtheow in ~/Desktop/test on default
$ cd .. && hg clone test newtest && cd newtest
updating working directory
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

sjl at ecgtheow in ~/Desktop/newtest on default
$ echo foo > a && hg com -m 'foo'

sjl at ecgtheow in ~/Desktop/newtest on default
$ hg glog
@  changeset:   1:d5044a872127 tip
|  summary:     foo
|
o  changeset:   0:5126e88e844d
    summary:     initial


sjl at ecgtheow in ~/Desktop/newtest on default
$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

sjl at ecgtheow in ~/Desktop/newtest on default
$ hg parents
changeset:   0:5126e88e844d
user:        Steve Losh <steve at stevelosh.com>
date:        Thu Jul 16 04:23:20 2009 -0400
summary:     initial


sjl at ecgtheow in ~/Desktop/newtest on default
$ hg pull -u
pulling from /Users/sjl/Desktop/test
searching for changes
no changes found
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

sjl at ecgtheow in ~/Desktop/newtest on default
$ hg parents
changeset:   1:d5044a872127
tag:         tip
user:        Steve Losh <steve at stevelosh.com>
date:        Thu Jul 16 04:24:12 2009 -0400
summary:     foo


sjl at ecgtheow in ~/Desktop/newtest on default
$


Here's a script to reproduce it:

#!/usr/bin/env bash
hg init test
cd test
touch a
hg com -Am 'initial'
cd ..
hg clone test newtest
cd newtest
echo foo > a
hg com -Am 'foo'
hg update 0
echo
echo '----- Before pull -u:'
hg parents
hg pull -u
echo
echo '----- After pull -u:'
hg parents

--
Steve Losh
http://stevelosh.com/



More information about the Mercurial-devel mailing list