Patchwork [1,of,2,V2] rebase: move bookmark update to before rebase clearing

login
register
mail settings
Submitter Durham Goode
Date Nov. 10, 2016, 5:27 p.m.
Message ID <03bc2afdfa26ad5ab057.1478798874@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17449/
State Accepted
Headers show

Comments

Durham Goode - Nov. 10, 2016, 5:27 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1478798501 28800
#      Thu Nov 10 09:21:41 2016 -0800
# Node ID 03bc2afdfa26ad5ab057a28ac037524407ca5a92
# Parent  3fd53cc1aad882ac9191d7388885acdbbc2d7103
rebase: move bookmark update to before rebase clearing

Bookmark fixing should probably happen before the rebase starts to clean up, so
let's move it before clearrebased. This will also help a future patch where we
want to add more clear logic to the existing clear section.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -482,19 +482,20 @@  class rebaseruntime(object):
             ui.note(_("update back to initial working directory parent\n"))
             hg.updaterepo(repo, newwd, False)
 
+        if self.currentbookmarks:
+            with repo.transaction('bookmark') as tr:
+                updatebookmarks(repo, targetnode, nstate,
+                                self.currentbookmarks, tr)
+                if self.activebookmark not in repo._bookmarks:
+                    # active bookmark was divergent one and has been deleted
+                    self.activebookmark = None
+
         if not self.keepf:
             collapsedas = None
             if self.collapsef:
                 collapsedas = newnode
             clearrebased(ui, repo, self.state, self.skipped, collapsedas)
 
-        with repo.transaction('bookmark') as tr:
-            if self.currentbookmarks:
-                updatebookmarks(repo, targetnode, nstate,
-                                self.currentbookmarks, tr)
-                if self.activebookmark not in repo._bookmarks:
-                    # active bookmark was divergent one and has been deleted
-                    self.activebookmark = None
         clearstatus(repo)
         clearcollapsemsg(repo)