##// END OF EJS Templates
strip: strip a list of bookmarks...
Shubhanshu Agrawal -
r27029:8279c5d1 default
parent child Browse files
Show More
@@ -44,7 +44,7 b' def checklocalchanges(repo, force=False,'
44 44 raise error.Abort(_("local changed subrepos found" + excsuffix))
45 45 return s
46 46
47 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmark=None):
47 def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None):
48 48 wlock = lock = None
49 49 try:
50 50 wlock = repo.wlock()
@@ -63,12 +63,14 b' def strip(ui, repo, revs, update=True, b'
63 63 repair.strip(ui, repo, revs, backup)
64 64
65 65 repomarks = repo._bookmarks
66 if bookmark:
67 if bookmark == repo._activebookmark:
66 if bookmarks:
67 if repo._activebookmark in bookmarks:
68 68 bookmarksmod.deactivate(repo)
69 del repomarks[bookmark]
69 for bookmark in bookmarks:
70 del repomarks[bookmark]
70 71 repomarks.write()
71 ui.write(_("bookmark '%s' deleted\n") % bookmark)
72 for bookmark in sorted(bookmarks):
73 ui.write(_("bookmark '%s' deleted\n") % bookmark)
72 74 finally:
73 75 release(lock, wlock)
74 76
@@ -127,27 +129,31 b' def stripcmd(ui, repo, *revs, **opts):'
127 129
128 130 wlock = repo.wlock()
129 131 try:
130 bookmark = opts.get('bookmark')
131 if bookmark:
132 bookmarks = None
133 if opts.get('bookmark'):
134 bookmarks = set([opts.get('bookmark')])
135 if bookmarks:
132 136 repomarks = repo._bookmarks
133 if bookmark not in repomarks:
134 raise error.Abort(_("bookmark '%s' not found") % bookmark)
137 if not bookmarks.issubset(repomarks):
138 raise error.Abort(_("bookmark '%s' not found") %
139 ','.join(sorted(bookmarks - set(repomarks.keys()))))
135 140
136 141 # If the requested bookmark is not the only one pointing to a
137 142 # a revision we have to only delete the bookmark and not strip
138 143 # anything. revsets cannot detect that case.
139 uniquebm = True
140 for m, n in repomarks.iteritems():
141 if m != bookmark and n == repo[bookmark].node():
142 uniquebm = False
143 break
144 if uniquebm:
145 rsrevs = repair.stripbmrevset(repo, bookmark)
146 revs.update(set(rsrevs))
144 nodetobookmarks = {}
145 for mark, node in repomarks.iteritems():
146 nodetobookmarks.setdefault(node, []).append(mark)
147 for marks in nodetobookmarks.values():
148 if bookmarks.issuperset(marks):
149 rsrevs = repair.stripbmrevset(repo, marks[0])
150 revs.update(set(rsrevs))
147 151 if not revs:
148 del repomarks[bookmark]
152 for bookmark in bookmarks:
153 del repomarks[bookmark]
149 154 repomarks.write()
150 ui.write(_("bookmark '%s' deleted\n") % bookmark)
155 for bookmark in sorted(bookmarks):
156 ui.write(_("bookmark '%s' deleted\n") % bookmark)
151 157
152 158 if not revs:
153 159 raise error.Abort(_('empty revision set'))
@@ -214,7 +220,7 b' def stripcmd(ui, repo, *revs, **opts):'
214 220
215 221
216 222 strip(ui, repo, revs, backup=backup, update=update,
217 force=opts.get('force'), bookmark=bookmark)
223 force=opts.get('force'), bookmarks=bookmarks)
218 224 finally:
219 225 wlock.release()
220 226
General Comments 0
You need to be logged in to leave comments. Login now