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