##// END OF EJS Templates
bookmarks: correctly update current bookmarks on rebase (issue2277)...
David Schleimer -
r17046:4116504d stable
parent child Browse files
Show More
@@ -247,6 +247,9 b' def rebase(ui, repo, **opts):'
247 247
248 248 # Keep track of the current bookmarks in order to reset them later
249 249 currentbookmarks = repo._bookmarks.copy()
250 activebookmark = repo._bookmarkcurrent
251 if activebookmark:
252 bookmarks.unsetcurrent(repo)
250 253
251 254 sortedstate = sorted(state)
252 255 total = len(sortedstate)
@@ -336,6 +339,11 b' def rebase(ui, repo, **opts):'
336 339 util.unlinkpath(repo.sjoin('undo'))
337 340 if skipped:
338 341 ui.note(_("%d revisions have been skipped\n") % len(skipped))
342
343 if (activebookmark and
344 repo['tip'].node() == repo._bookmarks[activebookmark]):
345 bookmarks.setcurrent(repo, activebookmark)
346
339 347 finally:
340 348 release(lock, wlock)
341 349
@@ -483,13 +491,11 b' def updatemq(repo, state, skipped, **opt'
483 491
484 492 def updatebookmarks(repo, nstate, originalbookmarks, **opts):
485 493 'Move bookmarks to their correct changesets'
486 current = repo._bookmarkcurrent
487 494 for k, v in originalbookmarks.iteritems():
488 495 if v in nstate:
489 496 if nstate[v] != nullmerge:
490 # reset the pointer if the bookmark was moved incorrectly
491 if k != current:
492 repo._bookmarks[k] = nstate[v]
497 # update the bookmarks for revs that have moved
498 repo._bookmarks[k] = nstate[v]
493 499
494 500 bookmarks.write(repo)
495 501
@@ -36,8 +36,10 b' Create a repo with several bookmarks'
36 36 adding d
37 37 created new head
38 38
39 $ hg book W
40
39 41 $ hg tglog
40 @ 3: 'D' bookmarks:
42 @ 3: 'D' bookmarks: W
41 43 |
42 44 | o 2: 'C' bookmarks: Y Z
43 45 | |
@@ -60,7 +62,7 b' Move only rebased bookmarks'
60 62 $ hg tglog
61 63 @ 3: 'C' bookmarks: Y Z
62 64 |
63 o 2: 'D' bookmarks:
65 o 2: 'D' bookmarks: W
64 66 |
65 67 | o 1: 'B' bookmarks: X
66 68 |/
@@ -82,7 +84,30 b' Keep bookmarks to the correct rebased ch'
82 84 |
83 85 o 2: 'B' bookmarks: X
84 86 |
85 o 1: 'D' bookmarks:
87 o 1: 'D' bookmarks: W
86 88 |
87 89 o 0: 'A' bookmarks:
88 90
91
92 Keep active bookmark on the correct changeset
93
94 $ cd ..
95 $ hg clone -q a a3
96
97 $ cd a3
98 $ hg up -q X
99
100 $ hg rebase -d W
101 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
102
103 $ hg tglog
104 @ 3: 'C' bookmarks: Y Z
105 |
106 o 2: 'B' bookmarks: X
107 |
108 o 1: 'D' bookmarks: W
109 |
110 o 0: 'A' bookmarks:
111
112
113 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now