diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -16,7 +16,7 @@ https://mercurial-scm.org/wiki/RebaseExt from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks from mercurial import extensions, patch, scmutil, phases, obsolete, error -from mercurial import copies, repoview, revset +from mercurial import copies, destutil, repoview, revset from mercurial.commands import templateopts from mercurial.node import nullrev, nullid, hex, short from mercurial.lock import release @@ -1145,7 +1145,6 @@ def pullrebase(orig, ui, repo, *args, ** ui.debug('--update and --rebase are not compatible, ignoring ' 'the update flag\n') - movemarkfrom = repo['.'].node() revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): @@ -1166,15 +1165,11 @@ def pullrebase(orig, ui, repo, *args, ** if 'source' in opts: del opts['source'] if rebase(ui, repo, **opts) == _nothingtorebase(): - branch = repo[None].branch() - dest = repo[branch].rev() - if dest != repo['.'].rev(): - # there was nothing to rebase we force an update - hg.update(repo, dest) - if bookmarks.update(repo, [movemarkfrom], - repo['.'].node()): - ui.status(_("updating bookmark %s\n") - % repo._activebookmark) + rev, _a, _b = destutil.destupdate(repo) + if rev != repo['.'].rev(): # we could update + # not passing argument to get the bare update behavior + # with warning and trumpets + commands.update(ui, repo) finally: release(lock, wlock) else: diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t --- a/tests/test-rebase-pull.t +++ b/tests/test-rebase-pull.t @@ -266,3 +266,46 @@ pull --rebase only update if there is no | o 0: 'C1' + +pull --rebase update (no rebase) use proper update: + +- warn about other head. + + $ cd ../a + $ echo R6 > R6 + $ hg ci -Am R6 + adding R6 + $ cd ../c + $ hg up 'desc(R5)' + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg pull --rebase + pulling from $TESTTMP/a (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads) + nothing to rebase - working directory parent is already an ancestor of destination 65bc164c1d9b + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 other heads for branch "default" + $ hg tglog + @ 9: 'R6' + | + | o 8: 'L2' + | | + | o 7: 'L1' + |/ + o 6: 'R5' + | + o 5: 'R4' + | + o 4: 'R3' + | + o 3: 'R2' + | + o 2: 'R1' + | + o 1: 'C2' + | + o 0: 'C1' +