Bug 1458 - Pull with "--rebase" flag doesn't imply "--update" (edit)
:
:
Status: RESOLVED FIXED
:
:
:
Assigned To:
Stefano Tortarolo (edit) (take)

(edit)
:
Depends on: (edit)
Blocks: (edit)
  Show dependency treegraph
 
Reported: 2009-01-08 09:48 EST by Wladimir Palant
Modified: 2009-03-30 10:52 EDT (History)
4 users (show)

(add)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wladimir Palant 2009-01-08 09:48:18 EST
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.
Comment 1 Dirkjan Ochtman 2009-01-08 10:03:15 EST
That's exactly right. hg pull -u doesn't update if there's nothing to pull.
Comment 2 Wladimir Palant 2009-01-08 10:57:56 EST
There was something to pull - but there were no local changes. In this situation
it should have updated.
Comment 3 Wladimir Palant 2009-01-08 11:02:25 EST
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.
Comment 4 Stefano Tortarolo 2009-01-08 12:20:09 EST
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.
Comment 5 Wladimir Palant 2009-01-09 00:23:49 EST
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.
Comment 6 Stefano Tortarolo 2009-01-17 05:57:16 EST
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
Comment 7 Wladimir Palant 2009-01-17 08:06:52 EST
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.
Comment 8 Stefano Tortarolo 2009-01-18 14:45:39 EST
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
Comment 9 Wladimir Palant 2009-01-19 00:23:11 EST
Looks good to me.
Comment 10 Stefano Tortarolo 2009-03-30 10:52:17 EDT
Fixed in 92455c1d6f83.
Comment 11 Bugzilla 2012-05-12 08:56:19 EDT

--- 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