--- a/hgext3rd/topic/__init__.py Fri Sep 01 18:02:50 2017 +0200
+++ b/hgext3rd/topic/__init__.py Mon Aug 14 14:36:11 2017 +0530
@@ -460,12 +460,29 @@
bmstore = repo._bookmarks
lock = wlock = tr = None
+ nodetobook = {}
+ for book, revnode in bmstore.iteritems():
+ if nodetobook.get(revnode):
+ nodetobook[revnode].append(book)
+ else:
+ nodetobook[revnode] = [book]
+
+ # a list of nodes which we have skipped so that we don't print the skip
+ # warning repeatedly
+ skipped = []
+
if bookmark:
try:
node = bmstore[bookmark]
except KeyError:
raise error.Abort(_("no such bookmark exists: '%s'") % bookmark)
+ if len(nodetobook[node]) > 1:
+ revnum = repo[node].rev()
+ ui.status(_("skipping revision '%d' as it has multiple bookmarks "
+ "on it\n") % revnum)
+ return
+
revnum = repo[node].rev()
try:
wlock = repo.wlock()
@@ -485,9 +502,17 @@
lock = repo.lock()
tr = repo.transaction('debugconvertbookmark')
for bmark, revnode in sorted(storecopy.iteritems()):
+ revnum = repo[revnode].rev()
+ if revnum in skipped:
+ continue
+ if len(nodetobook[revnode]) > 1:
+ ui.status(_("skipping '%d' as it has multiple bookmarks on"
+ " it\n") % revnum)
+ skipped.append(revnum)
+ continue
if bmark == '@':
continue
- _convertbmarktopic(ui, repo, repo[revnode].rev(), bmark, tr)
+ _convertbmarktopic(ui, repo, revnum, bmark, tr)
tr.close()
finally:
lockmod.release(tr, lock, wlock)