# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1330902732 21600
#      Sun Mar 04 17:12:12 2012 -0600
# Branch stable
# Node ID 5b41d5ad52bfd2a91197ab6908a3704244463f87
# Parent  674ecd23c42c76a794412e50e6cba64449243b86
rebase: move bookmarks as needed with pull --rebase (issue3285)

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -628,6 +628,7 @@
             ui.debug('--update and --rebase are not compatible, ignoring '
                      'the update flag\n')
 
+        movemarkfrom = repo['.'].node()
         cmdutil.bailifchanged(repo)
         revsprepull = len(repo)
         origpostincoming = commands.postincoming
@@ -646,6 +647,9 @@
             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._bookmarkcurrent)
     else:
         if opts.get('tool'):
             raise util.Abort(_('--tool can only be used with --rebase'))
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
@@ -77,6 +77,7 @@
 
   $ cd ../c
 
+  $ hg book norebase
   $ hg pull --rebase
   pulling from $TESTTMP/a (glob)
   searching for changes
@@ -86,6 +87,7 @@
   added 1 changesets with 1 changes to 1 files
   nothing to rebase
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updating bookmark norebase
 
   $ hg tglog -l 1
   @  2: 'R1'