https://bz.mercurial-scm.org/show_bug.cgi?id=5427

            Bug ID: 5427
           Summary: Docs for 'hg update' are misleading
           Product: Mercurial
           Version: 4.0-rc
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzi...@selenic.com
          Reporter: jwdevel+m...@gmail.com
                CC: mercurial-de...@selenic.com

Running "hg help update" gives:

... If the changeset is not a descendant or ancestor of the working
    directory's parent, the update is aborted.

That is not true in general. Barring extra flags being used, it is only true if
there are uncommitted changes, from what I can tell.

Using 'hg help -v update' is a little better, because it spells out the
different possibilities when there are uncommitted changes.

However, it still includes that general statement above which, generally
speaking, is not true.

In case you need proof:

    $ hg ini repo && cd repo
    $ echo initial text > foo.txt
    $ hg add
    adding foo.txt
    $ hg ci -m "Initial commit"
    $ echo "some changes" >> foo.txt 
    $ hg ci -m "change on initial head"
    $ hg up 0
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    $ echo "different changes, now on a new head" >> foo.txt 
    $ hg ci -m "made a new head"
    created new head
    $ hg log -G
    @  changeset:   2:0d460dee3543
    |  tag:         tip
    |  parent:      0:97a7eda6d95d
    |  user:        JW <jwde...@gmail.com>
    |  date:        Sun Nov 13 19:05:04 2016 -0800
    |  summary:     made a new head
    |
    | o  changeset:   1:6608fb084d61
    |/   user:        JW <jwde...@gmail.com>
    |    date:        Sun Nov 13 19:04:46 2016 -0800
    |    summary:     change on initial head
    |
    o  changeset:   0:97a7eda6d95d
       user:        JW <jwde...@gmail.com>
       date:        Sun Nov 13 19:04:24 2016 -0800
       summary:     Initial commit

    $ hg up 1
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved

    $ # As you can see, there was no problem updating to rev '1', despite that
it is neither a descendant nor ancestor of '2'.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to