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,11 +63,13 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 |
|
|
66 | if bookmarks: | |
|
67 | if repo._activebookmark in bookmarks: | |
|
68 | 68 | bookmarksmod.deactivate(repo) |
|
69 | for bookmark in bookmarks: | |
|
69 | 70 | del repomarks[bookmark] |
|
70 | 71 | repomarks.write() |
|
72 | for bookmark in sorted(bookmarks): | |
|
71 | 73 | ui.write(_("bookmark '%s' deleted\n") % bookmark) |
|
72 | 74 | finally: |
|
73 | 75 | release(lock, wlock) |
@@ -127,26 +129,30 b' def stripcmd(ui, repo, *revs, **opts):' | |||
|
127 | 129 | |
|
128 | 130 | wlock = repo.wlock() |
|
129 | 131 | try: |
|
130 |
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 |
|
|
134 |
raise error.Abort(_("bookmark '%s' not found") % |
|
|
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 |
|
|
|
140 | for m, n in repomarks.iteritems(): | |
|
141 | if m != bookmark and n == repo[bookmark].node(): | |
|
142 | uniquebm = False | |
|
143 |
|
|
|
144 | if uniquebm: | |
|
145 | rsrevs = repair.stripbmrevset(repo, bookmark) | |
|
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]) | |
|
146 | 150 | revs.update(set(rsrevs)) |
|
147 | 151 | if not revs: |
|
152 | for bookmark in bookmarks: | |
|
148 | 153 | del repomarks[bookmark] |
|
149 | 154 | repomarks.write() |
|
155 | for bookmark in sorted(bookmarks): | |
|
150 | 156 | ui.write(_("bookmark '%s' deleted\n") % bookmark) |
|
151 | 157 | |
|
152 | 158 | if not revs: |
@@ -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