Bugzilla – Bug 1458
Pull with "--rebase" flag doesn't imply "--update"
Last modified: 2009-03-30 10:52:17 EDT
http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject states: "[hg pull --rebase] pulls and rebases the local revisions if there's something to rebase. Otherwise it behaves like hg pull --update." Unfortunately, that's not true. If there is nothing to rebase, version 1.1.1+20081229 on Windows simply states "nothing to rebase" but doesn't update the repository. Specifying the "--update" flag in addition doesn't work either, this one isn't compatible with the rebase operation.
That's exactly right. hg pull -u doesn't update if there's nothing to pull.
There was something to pull - but there were no local changes. In this situation it should have updated.
Just to make it clear: $ hg pull --rebase pulling from http://hg.mozdev.org/adblockplus/ searching for changes adding changesets adding manifests adding file changes added 4 changesets with 12 changes to 11 files (run 'hg update' to get a working copy) nothing to rebase $ hg up 11 files updated, 0 files merged, 0 files removed, 0 files unresolved My understanding is that the second command shouldn't have been necessary.
Actually the documentation is wrong. pull --rebase moves the current work on the top of the pulled stuff, if there's nothing to move it just pulls. We can discuss whether this is the right behaviour but this is not a bug.
Ok, I guessed already that documentation is referring to a feature that was never implemented. Yet it would still be nice to have that feature. Reasoning: "pull = --rebase" in defaults should have the effect that your repository can always be brought up to date with a single command, regardless of local changes. Bonus points for updating only if the working directory was at the repository tip before the pull.
I've just sent a patch [1] that allows to have pull --rebase --update, this way we can get both behaviours. Does this look reasonable to you? [1] http://article.gmane.org/gmane.comp.version-control.mercurial.devel/19940
It might be more logical to have this behavior without an additional flag (always update in this situation) but it is fine either way. Thanks a lot.
Ok, I've sent another patch. http://article.gmane.org/gmane.comp.version-control.mercurial.devel/19987 Now pull --rebase behaviour is more consistent with pull -u. something to rebase => end up at the most recent revision nothing to rebase but pulled something => update nothing pulled => do nothing In addition, it ignores --update when using pull --rebase --update, since many people have pull = --update in their hgrc
Looks good to me.
Fixed in 92455c1d6f83.
--- Bug imported by bugzilla@serpentine.com 2012-05-12 08:56 EDT --- This bug was previously known as _bug_ 1458 at http://mercurial.selenic.com/bts/issue1458