##// END OF EJS Templates
bookmarks: delete divergent bookmarks on merge
David Soria Parra -
r16706:a270ec97 default
parent child Browse files
Show More
@@ -0,0 +1,31 b''
1 # init
2
3 $ hg init
4 $ echo a > a
5 $ hg add a
6 $ hg commit -m'a'
7 $ echo b > b
8 $ hg add b
9 $ hg commit -m'b'
10 $ hg up -C 0
11 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 $ echo c > c
13 $ hg add c
14 $ hg commit -m'c'
15 created new head
16
17 # test merging of diverged bookmarks
18 $ hg bookmark -r 1 "c@diverge"
19 $ hg bookmark -r 1 b
20 $ hg bookmark c
21 $ hg bookmarks
22 b 1:d2ae7f538514
23 * c 2:d36c0562f908
24 c@diverge 1:d2ae7f538514
25 $ hg merge "c@diverge"
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 (branch merge, don't forget to commit)
28 $ hg commit -m'merge'
29 $ hg bookmarks
30 b 1:d2ae7f538514
31 * c 3:b8f96cf4688b
@@ -150,13 +150,20 b' def updatecurrentbookmark(repo, oldnode,'
150 def update(repo, parents, node):
150 def update(repo, parents, node):
151 marks = repo._bookmarks
151 marks = repo._bookmarks
152 update = False
152 update = False
153 mark = repo._bookmarkcurrent
153 cur = repo._bookmarkcurrent
154 if not cur:
155 return False
156
157 toupdate = [b for b in marks if b.split('@', 1)[0] == cur.split('@', 1)[0]]
158 for mark in toupdate:
154 if mark and marks[mark] in parents:
159 if mark and marks[mark] in parents:
155 old = repo[marks[mark]]
160 old = repo[marks[mark]]
156 new = repo[node]
161 new = repo[node]
157 if new in old.descendants():
162 if new in old.descendants() and mark == cur:
158 marks[mark] = new.node()
163 marks[cur] = new.node()
159 update = True
164 update = True
165 if mark != cur:
166 del marks[mark]
160 if update:
167 if update:
161 repo._writebookmarks(marks)
168 repo._writebookmarks(marks)
162 return update
169 return update
@@ -1187,7 +1187,7 b' class localrepository(repo.repository):'
1187 raise
1187 raise
1188
1188
1189 # update bookmarks, dirstate and mergestate
1189 # update bookmarks, dirstate and mergestate
1190 bookmarks.update(self, p1, ret)
1190 bookmarks.update(self, [p1, p2], ret)
1191 for f in changes[0] + changes[1]:
1191 for f in changes[0] + changes[1]:
1192 self.dirstate.normal(f)
1192 self.dirstate.normal(f)
1193 for f in changes[2]:
1193 for f in changes[2]:
General Comments 0
You need to be logged in to leave comments. Login now