Show More
@@ -1,833 +1,833 b'' | |||||
1 | # shelve.py - save/restore working directory state |
|
1 | # shelve.py - save/restore working directory state | |
2 | # |
|
2 | # | |
3 | # Copyright 2013 Facebook, Inc. |
|
3 | # Copyright 2013 Facebook, Inc. | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | """save and restore changes to the working directory |
|
8 | """save and restore changes to the working directory | |
9 |
|
9 | |||
10 | The "hg shelve" command saves changes made to the working directory |
|
10 | The "hg shelve" command saves changes made to the working directory | |
11 | and reverts those changes, resetting the working directory to a clean |
|
11 | and reverts those changes, resetting the working directory to a clean | |
12 | state. |
|
12 | state. | |
13 |
|
13 | |||
14 | Later on, the "hg unshelve" command restores the changes saved by "hg |
|
14 | Later on, the "hg unshelve" command restores the changes saved by "hg | |
15 | shelve". Changes can be restored even after updating to a different |
|
15 | shelve". Changes can be restored even after updating to a different | |
16 | parent, in which case Mercurial's merge machinery will resolve any |
|
16 | parent, in which case Mercurial's merge machinery will resolve any | |
17 | conflicts if necessary. |
|
17 | conflicts if necessary. | |
18 |
|
18 | |||
19 | You can have more than one shelved change outstanding at a time; each |
|
19 | You can have more than one shelved change outstanding at a time; each | |
20 | shelved change has a distinct name. For details, see the help for "hg |
|
20 | shelved change has a distinct name. For details, see the help for "hg | |
21 | shelve". |
|
21 | shelve". | |
22 | """ |
|
22 | """ | |
23 |
|
23 | |||
24 | import collections |
|
24 | import collections | |
25 | import itertools |
|
25 | import itertools | |
26 | from mercurial.i18n import _ |
|
26 | from mercurial.i18n import _ | |
27 | from mercurial.node import nullid, nullrev, bin, hex |
|
27 | from mercurial.node import nullid, nullrev, bin, hex | |
28 | from mercurial import changegroup, cmdutil, scmutil, phases, commands |
|
28 | from mercurial import changegroup, cmdutil, scmutil, phases, commands | |
29 | from mercurial import error, hg, mdiff, merge, patch, repair, util |
|
29 | from mercurial import error, hg, mdiff, merge, patch, repair, util | |
30 | from mercurial import templatefilters, exchange, bundlerepo |
|
30 | from mercurial import templatefilters, exchange, bundlerepo | |
31 | from mercurial import lock as lockmod |
|
31 | from mercurial import lock as lockmod | |
32 | from hgext import rebase |
|
32 | from hgext import rebase | |
33 | import errno |
|
33 | import errno | |
34 |
|
34 | |||
35 | cmdtable = {} |
|
35 | cmdtable = {} | |
36 | command = cmdutil.command(cmdtable) |
|
36 | command = cmdutil.command(cmdtable) | |
37 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
|
37 | # Note for extension authors: ONLY specify testedwith = 'internal' for | |
38 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
38 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
39 | # be specifying the version(s) of Mercurial they are tested with, or |
|
39 | # be specifying the version(s) of Mercurial they are tested with, or | |
40 | # leave the attribute unspecified. |
|
40 | # leave the attribute unspecified. | |
41 | testedwith = 'internal' |
|
41 | testedwith = 'internal' | |
42 |
|
42 | |||
43 | backupdir = 'shelve-backup' |
|
43 | backupdir = 'shelve-backup' | |
44 |
|
44 | |||
45 | class shelvedfile(object): |
|
45 | class shelvedfile(object): | |
46 | """Helper for the file storing a single shelve |
|
46 | """Helper for the file storing a single shelve | |
47 |
|
47 | |||
48 | Handles common functions on shelve files (.hg/.patch) using |
|
48 | Handles common functions on shelve files (.hg/.patch) using | |
49 | the vfs layer""" |
|
49 | the vfs layer""" | |
50 | def __init__(self, repo, name, filetype=None): |
|
50 | def __init__(self, repo, name, filetype=None): | |
51 | self.repo = repo |
|
51 | self.repo = repo | |
52 | self.name = name |
|
52 | self.name = name | |
53 | self.vfs = scmutil.vfs(repo.join('shelved')) |
|
53 | self.vfs = scmutil.vfs(repo.join('shelved')) | |
54 | self.backupvfs = scmutil.vfs(repo.join(backupdir)) |
|
54 | self.backupvfs = scmutil.vfs(repo.join(backupdir)) | |
55 | self.ui = self.repo.ui |
|
55 | self.ui = self.repo.ui | |
56 | if filetype: |
|
56 | if filetype: | |
57 | self.fname = name + '.' + filetype |
|
57 | self.fname = name + '.' + filetype | |
58 | else: |
|
58 | else: | |
59 | self.fname = name |
|
59 | self.fname = name | |
60 |
|
60 | |||
61 | def exists(self): |
|
61 | def exists(self): | |
62 | return self.vfs.exists(self.fname) |
|
62 | return self.vfs.exists(self.fname) | |
63 |
|
63 | |||
64 | def filename(self): |
|
64 | def filename(self): | |
65 | return self.vfs.join(self.fname) |
|
65 | return self.vfs.join(self.fname) | |
66 |
|
66 | |||
67 | def backupfilename(self): |
|
67 | def backupfilename(self): | |
68 | def gennames(base): |
|
68 | def gennames(base): | |
69 | yield base |
|
69 | yield base | |
70 | base, ext = base.rsplit('.', 1) |
|
70 | base, ext = base.rsplit('.', 1) | |
71 | for i in itertools.count(1): |
|
71 | for i in itertools.count(1): | |
72 | yield '%s-%d.%s' % (base, i, ext) |
|
72 | yield '%s-%d.%s' % (base, i, ext) | |
73 |
|
73 | |||
74 | name = self.backupvfs.join(self.fname) |
|
74 | name = self.backupvfs.join(self.fname) | |
75 | for n in gennames(name): |
|
75 | for n in gennames(name): | |
76 | if not self.backupvfs.exists(n): |
|
76 | if not self.backupvfs.exists(n): | |
77 | return n |
|
77 | return n | |
78 |
|
78 | |||
79 | def movetobackup(self): |
|
79 | def movetobackup(self): | |
80 | if not self.backupvfs.isdir(): |
|
80 | if not self.backupvfs.isdir(): | |
81 | self.backupvfs.makedir() |
|
81 | self.backupvfs.makedir() | |
82 | util.rename(self.filename(), self.backupfilename()) |
|
82 | util.rename(self.filename(), self.backupfilename()) | |
83 |
|
83 | |||
84 | def stat(self): |
|
84 | def stat(self): | |
85 | return self.vfs.stat(self.fname) |
|
85 | return self.vfs.stat(self.fname) | |
86 |
|
86 | |||
87 | def opener(self, mode='rb'): |
|
87 | def opener(self, mode='rb'): | |
88 | try: |
|
88 | try: | |
89 | return self.vfs(self.fname, mode) |
|
89 | return self.vfs(self.fname, mode) | |
90 | except IOError as err: |
|
90 | except IOError as err: | |
91 | if err.errno != errno.ENOENT: |
|
91 | if err.errno != errno.ENOENT: | |
92 | raise |
|
92 | raise | |
93 | raise error.Abort(_("shelved change '%s' not found") % self.name) |
|
93 | raise error.Abort(_("shelved change '%s' not found") % self.name) | |
94 |
|
94 | |||
95 | def applybundle(self): |
|
95 | def applybundle(self): | |
96 | fp = self.opener() |
|
96 | fp = self.opener() | |
97 | try: |
|
97 | try: | |
98 | gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) |
|
98 | gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) | |
99 | changegroup.addchangegroup(self.repo, gen, 'unshelve', |
|
99 | changegroup.addchangegroup(self.repo, gen, 'unshelve', | |
100 | 'bundle:' + self.vfs.join(self.fname), |
|
100 | 'bundle:' + self.vfs.join(self.fname), | |
101 | targetphase=phases.secret) |
|
101 | targetphase=phases.secret) | |
102 | finally: |
|
102 | finally: | |
103 | fp.close() |
|
103 | fp.close() | |
104 |
|
104 | |||
105 | def bundlerepo(self): |
|
105 | def bundlerepo(self): | |
106 | return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, |
|
106 | return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, | |
107 | self.vfs.join(self.fname)) |
|
107 | self.vfs.join(self.fname)) | |
108 | def writebundle(self, bases, node): |
|
108 | def writebundle(self, bases, node): | |
109 | btype = 'HG10BZ' |
|
109 | btype = 'HG10BZ' | |
110 | cgversion = '01' |
|
110 | cgversion = '01' | |
111 | compression = None |
|
111 | compression = None | |
112 | if 'generaldelta' in self.repo.requirements: |
|
112 | if 'generaldelta' in self.repo.requirements: | |
113 | btype = 'HG20' |
|
113 | btype = 'HG20' | |
114 | cgversion = '02' |
|
114 | cgversion = '02' | |
115 | compression = 'BZ' |
|
115 | compression = 'BZ' | |
116 |
|
116 | |||
117 | cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve', |
|
117 | cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve', | |
118 | version=cgversion) |
|
118 | version=cgversion) | |
119 | changegroup.writebundle(self.ui, cg, self.fname, btype, self.vfs, |
|
119 | changegroup.writebundle(self.ui, cg, self.fname, btype, self.vfs, | |
120 | compression=compression) |
|
120 | compression=compression) | |
121 |
|
121 | |||
122 | class shelvedstate(object): |
|
122 | class shelvedstate(object): | |
123 | """Handle persistence during unshelving operations. |
|
123 | """Handle persistence during unshelving operations. | |
124 |
|
124 | |||
125 | Handles saving and restoring a shelved state. Ensures that different |
|
125 | Handles saving and restoring a shelved state. Ensures that different | |
126 | versions of a shelved state are possible and handles them appropriately. |
|
126 | versions of a shelved state are possible and handles them appropriately. | |
127 | """ |
|
127 | """ | |
128 | _version = 1 |
|
128 | _version = 1 | |
129 | _filename = 'shelvedstate' |
|
129 | _filename = 'shelvedstate' | |
130 |
|
130 | |||
131 | @classmethod |
|
131 | @classmethod | |
132 | def load(cls, repo): |
|
132 | def load(cls, repo): | |
133 | fp = repo.vfs(cls._filename) |
|
133 | fp = repo.vfs(cls._filename) | |
134 | try: |
|
134 | try: | |
135 | version = int(fp.readline().strip()) |
|
135 | version = int(fp.readline().strip()) | |
136 |
|
136 | |||
137 | if version != cls._version: |
|
137 | if version != cls._version: | |
138 | raise error.Abort(_('this version of shelve is incompatible ' |
|
138 | raise error.Abort(_('this version of shelve is incompatible ' | |
139 | 'with the version used in this repo')) |
|
139 | 'with the version used in this repo')) | |
140 | name = fp.readline().strip() |
|
140 | name = fp.readline().strip() | |
141 | wctx = fp.readline().strip() |
|
141 | wctx = fp.readline().strip() | |
142 | pendingctx = fp.readline().strip() |
|
142 | pendingctx = fp.readline().strip() | |
143 | parents = [bin(h) for h in fp.readline().split()] |
|
143 | parents = [bin(h) for h in fp.readline().split()] | |
144 | stripnodes = [bin(h) for h in fp.readline().split()] |
|
144 | stripnodes = [bin(h) for h in fp.readline().split()] | |
145 | finally: |
|
145 | finally: | |
146 | fp.close() |
|
146 | fp.close() | |
147 |
|
147 | |||
148 | obj = cls() |
|
148 | obj = cls() | |
149 | obj.name = name |
|
149 | obj.name = name | |
150 | obj.wctx = repo[bin(wctx)] |
|
150 | obj.wctx = repo[bin(wctx)] | |
151 | obj.pendingctx = repo[bin(pendingctx)] |
|
151 | obj.pendingctx = repo[bin(pendingctx)] | |
152 | obj.parents = parents |
|
152 | obj.parents = parents | |
153 | obj.stripnodes = stripnodes |
|
153 | obj.stripnodes = stripnodes | |
154 |
|
154 | |||
155 | return obj |
|
155 | return obj | |
156 |
|
156 | |||
157 | @classmethod |
|
157 | @classmethod | |
158 | def save(cls, repo, name, originalwctx, pendingctx, stripnodes): |
|
158 | def save(cls, repo, name, originalwctx, pendingctx, stripnodes): | |
159 | fp = repo.vfs(cls._filename, 'wb') |
|
159 | fp = repo.vfs(cls._filename, 'wb') | |
160 | fp.write('%i\n' % cls._version) |
|
160 | fp.write('%i\n' % cls._version) | |
161 | fp.write('%s\n' % name) |
|
161 | fp.write('%s\n' % name) | |
162 | fp.write('%s\n' % hex(originalwctx.node())) |
|
162 | fp.write('%s\n' % hex(originalwctx.node())) | |
163 | fp.write('%s\n' % hex(pendingctx.node())) |
|
163 | fp.write('%s\n' % hex(pendingctx.node())) | |
164 | fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()])) |
|
164 | fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()])) | |
165 | fp.write('%s\n' % ' '.join([hex(n) for n in stripnodes])) |
|
165 | fp.write('%s\n' % ' '.join([hex(n) for n in stripnodes])) | |
166 | fp.close() |
|
166 | fp.close() | |
167 |
|
167 | |||
168 | @classmethod |
|
168 | @classmethod | |
169 | def clear(cls, repo): |
|
169 | def clear(cls, repo): | |
170 | util.unlinkpath(repo.join(cls._filename), ignoremissing=True) |
|
170 | util.unlinkpath(repo.join(cls._filename), ignoremissing=True) | |
171 |
|
171 | |||
172 | def cleanupoldbackups(repo): |
|
172 | def cleanupoldbackups(repo): | |
173 | vfs = scmutil.vfs(repo.join(backupdir)) |
|
173 | vfs = scmutil.vfs(repo.join(backupdir)) | |
174 | maxbackups = repo.ui.configint('shelve', 'maxbackups', 10) |
|
174 | maxbackups = repo.ui.configint('shelve', 'maxbackups', 10) | |
175 | hgfiles = [f for f in vfs.listdir() if f.endswith('.hg')] |
|
175 | hgfiles = [f for f in vfs.listdir() if f.endswith('.hg')] | |
176 | hgfiles = sorted([(vfs.stat(f).st_mtime, f) for f in hgfiles]) |
|
176 | hgfiles = sorted([(vfs.stat(f).st_mtime, f) for f in hgfiles]) | |
177 | if 0 < maxbackups and maxbackups < len(hgfiles): |
|
177 | if 0 < maxbackups and maxbackups < len(hgfiles): | |
178 | bordermtime = hgfiles[-maxbackups][0] |
|
178 | bordermtime = hgfiles[-maxbackups][0] | |
179 | else: |
|
179 | else: | |
180 | bordermtime = None |
|
180 | bordermtime = None | |
181 | for mtime, f in hgfiles[:len(hgfiles) - maxbackups]: |
|
181 | for mtime, f in hgfiles[:len(hgfiles) - maxbackups]: | |
182 | if mtime == bordermtime: |
|
182 | if mtime == bordermtime: | |
183 | # keep it, because timestamp can't decide exact order of backups |
|
183 | # keep it, because timestamp can't decide exact order of backups | |
184 | continue |
|
184 | continue | |
185 | base = f[:-3] |
|
185 | base = f[:-3] | |
186 | for ext in 'hg patch'.split(): |
|
186 | for ext in 'hg patch'.split(): | |
187 | try: |
|
187 | try: | |
188 | vfs.unlink(base + '.' + ext) |
|
188 | vfs.unlink(base + '.' + ext) | |
189 | except OSError as err: |
|
189 | except OSError as err: | |
190 | if err.errno != errno.ENOENT: |
|
190 | if err.errno != errno.ENOENT: | |
191 | raise |
|
191 | raise | |
192 |
|
192 | |||
193 | def _aborttransaction(repo): |
|
193 | def _aborttransaction(repo): | |
194 | '''Abort current transaction for shelve/unshelve, but keep dirstate |
|
194 | '''Abort current transaction for shelve/unshelve, but keep dirstate | |
195 | ''' |
|
195 | ''' | |
196 | backupname = 'dirstate.shelve' |
|
196 | backupname = 'dirstate.shelve' | |
197 | dirstatebackup = None |
|
197 | dirstatebackup = None | |
198 | try: |
|
198 | try: | |
199 | # create backup of (un)shelved dirstate, because aborting transaction |
|
199 | # create backup of (un)shelved dirstate, because aborting transaction | |
200 | # should restore dirstate to one at the beginning of the |
|
200 | # should restore dirstate to one at the beginning of the | |
201 | # transaction, which doesn't include the result of (un)shelving |
|
201 | # transaction, which doesn't include the result of (un)shelving | |
202 | fp = repo.vfs.open(backupname, "w") |
|
202 | fp = repo.vfs.open(backupname, "w") | |
203 | dirstatebackup = backupname |
|
203 | dirstatebackup = backupname | |
204 | # clearing _dirty/_dirtypl of dirstate by _writedirstate below |
|
204 | # clearing _dirty/_dirtypl of dirstate by _writedirstate below | |
205 | # is unintentional. but it doesn't cause problem in this case, |
|
205 | # is unintentional. but it doesn't cause problem in this case, | |
206 | # because no code path refers them until transaction is aborted. |
|
206 | # because no code path refers them until transaction is aborted. | |
207 | repo.dirstate._writedirstate(fp) # write in-memory changes forcibly |
|
207 | repo.dirstate._writedirstate(fp) # write in-memory changes forcibly | |
208 |
|
208 | |||
209 | tr = repo.currenttransaction() |
|
209 | tr = repo.currenttransaction() | |
210 | tr.abort() |
|
210 | tr.abort() | |
211 |
|
211 | |||
212 | # restore to backuped dirstate |
|
212 | # restore to backuped dirstate | |
213 | repo.vfs.rename(dirstatebackup, 'dirstate') |
|
213 | repo.vfs.rename(dirstatebackup, 'dirstate') | |
214 | dirstatebackup = None |
|
214 | dirstatebackup = None | |
215 | finally: |
|
215 | finally: | |
216 | if dirstatebackup: |
|
216 | if dirstatebackup: | |
217 | repo.vfs.unlink(dirstatebackup) |
|
217 | repo.vfs.unlink(dirstatebackup) | |
218 |
|
218 | |||
219 | def createcmd(ui, repo, pats, opts): |
|
219 | def createcmd(ui, repo, pats, opts): | |
220 | """subcommand that creates a new shelve""" |
|
220 | """subcommand that creates a new shelve""" | |
221 |
|
221 | |||
222 |
def |
|
222 | def mutableancestors(ctx): | |
223 | """Compute the public ancestors of a commit. |
|
223 | """return all mutable ancestors for ctx (included) | |
224 |
|
224 | |||
225 | Much faster than the revset ancestors(ctx) & draft()""" |
|
225 | Much faster than the revset ancestors(ctx) & draft()""" | |
226 | seen = set([nullrev]) |
|
226 | seen = set([nullrev]) | |
227 | visit = collections.deque() |
|
227 | visit = collections.deque() | |
228 | visit.append(ctx) |
|
228 | visit.append(ctx) | |
229 | while visit: |
|
229 | while visit: | |
230 | ctx = visit.popleft() |
|
230 | ctx = visit.popleft() | |
231 | yield ctx.node() |
|
231 | yield ctx.node() | |
232 | for parent in ctx.parents(): |
|
232 | for parent in ctx.parents(): | |
233 | rev = parent.rev() |
|
233 | rev = parent.rev() | |
234 | if rev not in seen: |
|
234 | if rev not in seen: | |
235 | seen.add(rev) |
|
235 | seen.add(rev) | |
236 | if parent.mutable(): |
|
236 | if parent.mutable(): | |
237 | visit.append(parent) |
|
237 | visit.append(parent) | |
238 |
|
238 | |||
239 | wctx = repo[None] |
|
239 | wctx = repo[None] | |
240 | parents = wctx.parents() |
|
240 | parents = wctx.parents() | |
241 | if len(parents) > 1: |
|
241 | if len(parents) > 1: | |
242 | raise error.Abort(_('cannot shelve while merging')) |
|
242 | raise error.Abort(_('cannot shelve while merging')) | |
243 | parent = parents[0] |
|
243 | parent = parents[0] | |
244 |
|
244 | |||
245 | # we never need the user, so we use a generic user for all shelve operations |
|
245 | # we never need the user, so we use a generic user for all shelve operations | |
246 | user = 'shelve@localhost' |
|
246 | user = 'shelve@localhost' | |
247 | label = repo._activebookmark or parent.branch() or 'default' |
|
247 | label = repo._activebookmark or parent.branch() or 'default' | |
248 |
|
248 | |||
249 | # slashes aren't allowed in filenames, therefore we rename it |
|
249 | # slashes aren't allowed in filenames, therefore we rename it | |
250 | label = label.replace('/', '_') |
|
250 | label = label.replace('/', '_') | |
251 |
|
251 | |||
252 | def gennames(): |
|
252 | def gennames(): | |
253 | yield label |
|
253 | yield label | |
254 | for i in xrange(1, 100): |
|
254 | for i in xrange(1, 100): | |
255 | yield '%s-%02d' % (label, i) |
|
255 | yield '%s-%02d' % (label, i) | |
256 |
|
256 | |||
257 | def commitfunc(ui, repo, message, match, opts): |
|
257 | def commitfunc(ui, repo, message, match, opts): | |
258 | hasmq = util.safehasattr(repo, 'mq') |
|
258 | hasmq = util.safehasattr(repo, 'mq') | |
259 | if hasmq: |
|
259 | if hasmq: | |
260 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False |
|
260 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False | |
261 | backup = repo.ui.backupconfig('phases', 'new-commit') |
|
261 | backup = repo.ui.backupconfig('phases', 'new-commit') | |
262 | try: |
|
262 | try: | |
263 | repo.ui. setconfig('phases', 'new-commit', phases.secret) |
|
263 | repo.ui. setconfig('phases', 'new-commit', phases.secret) | |
264 | editor = cmdutil.getcommiteditor(editform='shelve.shelve', **opts) |
|
264 | editor = cmdutil.getcommiteditor(editform='shelve.shelve', **opts) | |
265 | return repo.commit(message, user, opts.get('date'), match, |
|
265 | return repo.commit(message, user, opts.get('date'), match, | |
266 | editor=editor) |
|
266 | editor=editor) | |
267 | finally: |
|
267 | finally: | |
268 | repo.ui.restoreconfig(backup) |
|
268 | repo.ui.restoreconfig(backup) | |
269 | if hasmq: |
|
269 | if hasmq: | |
270 | repo.mq.checkapplied = saved |
|
270 | repo.mq.checkapplied = saved | |
271 |
|
271 | |||
272 | if parent.node() != nullid: |
|
272 | if parent.node() != nullid: | |
273 | desc = "changes to '%s'" % parent.description().split('\n', 1)[0] |
|
273 | desc = "changes to '%s'" % parent.description().split('\n', 1)[0] | |
274 | else: |
|
274 | else: | |
275 | desc = '(changes in empty repository)' |
|
275 | desc = '(changes in empty repository)' | |
276 |
|
276 | |||
277 | if not opts['message']: |
|
277 | if not opts['message']: | |
278 | opts['message'] = desc |
|
278 | opts['message'] = desc | |
279 |
|
279 | |||
280 | name = opts['name'] |
|
280 | name = opts['name'] | |
281 |
|
281 | |||
282 | wlock = lock = tr = None |
|
282 | wlock = lock = tr = None | |
283 | try: |
|
283 | try: | |
284 | wlock = repo.wlock() |
|
284 | wlock = repo.wlock() | |
285 | lock = repo.lock() |
|
285 | lock = repo.lock() | |
286 |
|
286 | |||
287 | # use an uncommitted transaction to generate the bundle to avoid |
|
287 | # use an uncommitted transaction to generate the bundle to avoid | |
288 | # pull races. ensure we don't print the abort message to stderr. |
|
288 | # pull races. ensure we don't print the abort message to stderr. | |
289 | tr = repo.transaction('commit', report=lambda x: None) |
|
289 | tr = repo.transaction('commit', report=lambda x: None) | |
290 |
|
290 | |||
291 | if name: |
|
291 | if name: | |
292 | if shelvedfile(repo, name, 'hg').exists(): |
|
292 | if shelvedfile(repo, name, 'hg').exists(): | |
293 | raise error.Abort(_("a shelved change named '%s' already exists" |
|
293 | raise error.Abort(_("a shelved change named '%s' already exists" | |
294 | ) % name) |
|
294 | ) % name) | |
295 | else: |
|
295 | else: | |
296 | for n in gennames(): |
|
296 | for n in gennames(): | |
297 | if not shelvedfile(repo, n, 'hg').exists(): |
|
297 | if not shelvedfile(repo, n, 'hg').exists(): | |
298 | name = n |
|
298 | name = n | |
299 | break |
|
299 | break | |
300 | else: |
|
300 | else: | |
301 | raise error.Abort(_("too many shelved changes named '%s'") % |
|
301 | raise error.Abort(_("too many shelved changes named '%s'") % | |
302 | label) |
|
302 | label) | |
303 |
|
303 | |||
304 | # ensure we are not creating a subdirectory or a hidden file |
|
304 | # ensure we are not creating a subdirectory or a hidden file | |
305 | if '/' in name or '\\' in name: |
|
305 | if '/' in name or '\\' in name: | |
306 | raise error.Abort(_('shelved change names may not contain slashes')) |
|
306 | raise error.Abort(_('shelved change names may not contain slashes')) | |
307 | if name.startswith('.'): |
|
307 | if name.startswith('.'): | |
308 | raise error.Abort(_("shelved change names may not start with '.'")) |
|
308 | raise error.Abort(_("shelved change names may not start with '.'")) | |
309 | interactive = opts.get('interactive', False) |
|
309 | interactive = opts.get('interactive', False) | |
310 |
|
310 | |||
311 | def interactivecommitfunc(ui, repo, *pats, **opts): |
|
311 | def interactivecommitfunc(ui, repo, *pats, **opts): | |
312 | match = scmutil.match(repo['.'], pats, {}) |
|
312 | match = scmutil.match(repo['.'], pats, {}) | |
313 | message = opts['message'] |
|
313 | message = opts['message'] | |
314 | return commitfunc(ui, repo, message, match, opts) |
|
314 | return commitfunc(ui, repo, message, match, opts) | |
315 | if not interactive: |
|
315 | if not interactive: | |
316 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
|
316 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | |
317 | else: |
|
317 | else: | |
318 | node = cmdutil.dorecord(ui, repo, interactivecommitfunc, None, |
|
318 | node = cmdutil.dorecord(ui, repo, interactivecommitfunc, None, | |
319 | False, cmdutil.recordfilter, *pats, **opts) |
|
319 | False, cmdutil.recordfilter, *pats, **opts) | |
320 | if not node: |
|
320 | if not node: | |
321 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) |
|
321 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | |
322 | if stat.deleted: |
|
322 | if stat.deleted: | |
323 | ui.status(_("nothing changed (%d missing files, see " |
|
323 | ui.status(_("nothing changed (%d missing files, see " | |
324 | "'hg status')\n") % len(stat.deleted)) |
|
324 | "'hg status')\n") % len(stat.deleted)) | |
325 | else: |
|
325 | else: | |
326 | ui.status(_("nothing changed\n")) |
|
326 | ui.status(_("nothing changed\n")) | |
327 | return 1 |
|
327 | return 1 | |
328 |
|
328 | |||
329 |
bases = list( |
|
329 | bases = list(mutableancestors(repo[node])) | |
330 | shelvedfile(repo, name, 'hg').writebundle(bases, node) |
|
330 | shelvedfile(repo, name, 'hg').writebundle(bases, node) | |
331 | cmdutil.export(repo, [node], |
|
331 | cmdutil.export(repo, [node], | |
332 | fp=shelvedfile(repo, name, 'patch').opener('wb'), |
|
332 | fp=shelvedfile(repo, name, 'patch').opener('wb'), | |
333 | opts=mdiff.diffopts(git=True)) |
|
333 | opts=mdiff.diffopts(git=True)) | |
334 |
|
334 | |||
335 |
|
335 | |||
336 | if ui.formatted(): |
|
336 | if ui.formatted(): | |
337 | desc = util.ellipsis(desc, ui.termwidth()) |
|
337 | desc = util.ellipsis(desc, ui.termwidth()) | |
338 | ui.status(_('shelved as %s\n') % name) |
|
338 | ui.status(_('shelved as %s\n') % name) | |
339 | hg.update(repo, parent.node()) |
|
339 | hg.update(repo, parent.node()) | |
340 |
|
340 | |||
341 | _aborttransaction(repo) |
|
341 | _aborttransaction(repo) | |
342 | finally: |
|
342 | finally: | |
343 | lockmod.release(tr, lock, wlock) |
|
343 | lockmod.release(tr, lock, wlock) | |
344 |
|
344 | |||
345 | def cleanupcmd(ui, repo): |
|
345 | def cleanupcmd(ui, repo): | |
346 | """subcommand that deletes all shelves""" |
|
346 | """subcommand that deletes all shelves""" | |
347 |
|
347 | |||
348 | wlock = None |
|
348 | wlock = None | |
349 | try: |
|
349 | try: | |
350 | wlock = repo.wlock() |
|
350 | wlock = repo.wlock() | |
351 | for (name, _type) in repo.vfs.readdir('shelved'): |
|
351 | for (name, _type) in repo.vfs.readdir('shelved'): | |
352 | suffix = name.rsplit('.', 1)[-1] |
|
352 | suffix = name.rsplit('.', 1)[-1] | |
353 | if suffix in ('hg', 'patch'): |
|
353 | if suffix in ('hg', 'patch'): | |
354 | shelvedfile(repo, name).movetobackup() |
|
354 | shelvedfile(repo, name).movetobackup() | |
355 | cleanupoldbackups(repo) |
|
355 | cleanupoldbackups(repo) | |
356 | finally: |
|
356 | finally: | |
357 | lockmod.release(wlock) |
|
357 | lockmod.release(wlock) | |
358 |
|
358 | |||
359 | def deletecmd(ui, repo, pats): |
|
359 | def deletecmd(ui, repo, pats): | |
360 | """subcommand that deletes a specific shelve""" |
|
360 | """subcommand that deletes a specific shelve""" | |
361 | if not pats: |
|
361 | if not pats: | |
362 | raise error.Abort(_('no shelved changes specified!')) |
|
362 | raise error.Abort(_('no shelved changes specified!')) | |
363 | wlock = repo.wlock() |
|
363 | wlock = repo.wlock() | |
364 | try: |
|
364 | try: | |
365 | for name in pats: |
|
365 | for name in pats: | |
366 | for suffix in 'hg patch'.split(): |
|
366 | for suffix in 'hg patch'.split(): | |
367 | shelvedfile(repo, name, suffix).movetobackup() |
|
367 | shelvedfile(repo, name, suffix).movetobackup() | |
368 | cleanupoldbackups(repo) |
|
368 | cleanupoldbackups(repo) | |
369 | except OSError as err: |
|
369 | except OSError as err: | |
370 | if err.errno != errno.ENOENT: |
|
370 | if err.errno != errno.ENOENT: | |
371 | raise |
|
371 | raise | |
372 | raise error.Abort(_("shelved change '%s' not found") % name) |
|
372 | raise error.Abort(_("shelved change '%s' not found") % name) | |
373 | finally: |
|
373 | finally: | |
374 | lockmod.release(wlock) |
|
374 | lockmod.release(wlock) | |
375 |
|
375 | |||
376 | def listshelves(repo): |
|
376 | def listshelves(repo): | |
377 | """return all shelves in repo as list of (time, filename)""" |
|
377 | """return all shelves in repo as list of (time, filename)""" | |
378 | try: |
|
378 | try: | |
379 | names = repo.vfs.readdir('shelved') |
|
379 | names = repo.vfs.readdir('shelved') | |
380 | except OSError as err: |
|
380 | except OSError as err: | |
381 | if err.errno != errno.ENOENT: |
|
381 | if err.errno != errno.ENOENT: | |
382 | raise |
|
382 | raise | |
383 | return [] |
|
383 | return [] | |
384 | info = [] |
|
384 | info = [] | |
385 | for (name, _type) in names: |
|
385 | for (name, _type) in names: | |
386 | pfx, sfx = name.rsplit('.', 1) |
|
386 | pfx, sfx = name.rsplit('.', 1) | |
387 | if not pfx or sfx != 'patch': |
|
387 | if not pfx or sfx != 'patch': | |
388 | continue |
|
388 | continue | |
389 | st = shelvedfile(repo, name).stat() |
|
389 | st = shelvedfile(repo, name).stat() | |
390 | info.append((st.st_mtime, shelvedfile(repo, pfx).filename())) |
|
390 | info.append((st.st_mtime, shelvedfile(repo, pfx).filename())) | |
391 | return sorted(info, reverse=True) |
|
391 | return sorted(info, reverse=True) | |
392 |
|
392 | |||
393 | def listcmd(ui, repo, pats, opts): |
|
393 | def listcmd(ui, repo, pats, opts): | |
394 | """subcommand that displays the list of shelves""" |
|
394 | """subcommand that displays the list of shelves""" | |
395 | pats = set(pats) |
|
395 | pats = set(pats) | |
396 | width = 80 |
|
396 | width = 80 | |
397 | if not ui.plain(): |
|
397 | if not ui.plain(): | |
398 | width = ui.termwidth() |
|
398 | width = ui.termwidth() | |
399 | namelabel = 'shelve.newest' |
|
399 | namelabel = 'shelve.newest' | |
400 | for mtime, name in listshelves(repo): |
|
400 | for mtime, name in listshelves(repo): | |
401 | sname = util.split(name)[1] |
|
401 | sname = util.split(name)[1] | |
402 | if pats and sname not in pats: |
|
402 | if pats and sname not in pats: | |
403 | continue |
|
403 | continue | |
404 | ui.write(sname, label=namelabel) |
|
404 | ui.write(sname, label=namelabel) | |
405 | namelabel = 'shelve.name' |
|
405 | namelabel = 'shelve.name' | |
406 | if ui.quiet: |
|
406 | if ui.quiet: | |
407 | ui.write('\n') |
|
407 | ui.write('\n') | |
408 | continue |
|
408 | continue | |
409 | ui.write(' ' * (16 - len(sname))) |
|
409 | ui.write(' ' * (16 - len(sname))) | |
410 | used = 16 |
|
410 | used = 16 | |
411 | age = '(%s)' % templatefilters.age(util.makedate(mtime), abbrev=True) |
|
411 | age = '(%s)' % templatefilters.age(util.makedate(mtime), abbrev=True) | |
412 | ui.write(age, label='shelve.age') |
|
412 | ui.write(age, label='shelve.age') | |
413 | ui.write(' ' * (12 - len(age))) |
|
413 | ui.write(' ' * (12 - len(age))) | |
414 | used += 12 |
|
414 | used += 12 | |
415 | fp = open(name + '.patch', 'rb') |
|
415 | fp = open(name + '.patch', 'rb') | |
416 | try: |
|
416 | try: | |
417 | while True: |
|
417 | while True: | |
418 | line = fp.readline() |
|
418 | line = fp.readline() | |
419 | if not line: |
|
419 | if not line: | |
420 | break |
|
420 | break | |
421 | if not line.startswith('#'): |
|
421 | if not line.startswith('#'): | |
422 | desc = line.rstrip() |
|
422 | desc = line.rstrip() | |
423 | if ui.formatted(): |
|
423 | if ui.formatted(): | |
424 | desc = util.ellipsis(desc, width - used) |
|
424 | desc = util.ellipsis(desc, width - used) | |
425 | ui.write(desc) |
|
425 | ui.write(desc) | |
426 | break |
|
426 | break | |
427 | ui.write('\n') |
|
427 | ui.write('\n') | |
428 | if not (opts['patch'] or opts['stat']): |
|
428 | if not (opts['patch'] or opts['stat']): | |
429 | continue |
|
429 | continue | |
430 | difflines = fp.readlines() |
|
430 | difflines = fp.readlines() | |
431 | if opts['patch']: |
|
431 | if opts['patch']: | |
432 | for chunk, label in patch.difflabel(iter, difflines): |
|
432 | for chunk, label in patch.difflabel(iter, difflines): | |
433 | ui.write(chunk, label=label) |
|
433 | ui.write(chunk, label=label) | |
434 | if opts['stat']: |
|
434 | if opts['stat']: | |
435 | for chunk, label in patch.diffstatui(difflines, width=width, |
|
435 | for chunk, label in patch.diffstatui(difflines, width=width, | |
436 | git=True): |
|
436 | git=True): | |
437 | ui.write(chunk, label=label) |
|
437 | ui.write(chunk, label=label) | |
438 | finally: |
|
438 | finally: | |
439 | fp.close() |
|
439 | fp.close() | |
440 |
|
440 | |||
441 | def singlepatchcmds(ui, repo, pats, opts, subcommand): |
|
441 | def singlepatchcmds(ui, repo, pats, opts, subcommand): | |
442 | """subcommand that displays a single shelf""" |
|
442 | """subcommand that displays a single shelf""" | |
443 | if len(pats) != 1: |
|
443 | if len(pats) != 1: | |
444 | raise error.Abort(_("--%s expects a single shelf") % subcommand) |
|
444 | raise error.Abort(_("--%s expects a single shelf") % subcommand) | |
445 | shelfname = pats[0] |
|
445 | shelfname = pats[0] | |
446 |
|
446 | |||
447 | if not shelvedfile(repo, shelfname, 'patch').exists(): |
|
447 | if not shelvedfile(repo, shelfname, 'patch').exists(): | |
448 | raise error.Abort(_("cannot find shelf %s") % shelfname) |
|
448 | raise error.Abort(_("cannot find shelf %s") % shelfname) | |
449 |
|
449 | |||
450 | listcmd(ui, repo, pats, opts) |
|
450 | listcmd(ui, repo, pats, opts) | |
451 |
|
451 | |||
452 | def checkparents(repo, state): |
|
452 | def checkparents(repo, state): | |
453 | """check parent while resuming an unshelve""" |
|
453 | """check parent while resuming an unshelve""" | |
454 | if state.parents != repo.dirstate.parents(): |
|
454 | if state.parents != repo.dirstate.parents(): | |
455 | raise error.Abort(_('working directory parents do not match unshelve ' |
|
455 | raise error.Abort(_('working directory parents do not match unshelve ' | |
456 | 'state')) |
|
456 | 'state')) | |
457 |
|
457 | |||
458 | def pathtofiles(repo, files): |
|
458 | def pathtofiles(repo, files): | |
459 | cwd = repo.getcwd() |
|
459 | cwd = repo.getcwd() | |
460 | return [repo.pathto(f, cwd) for f in files] |
|
460 | return [repo.pathto(f, cwd) for f in files] | |
461 |
|
461 | |||
462 | def unshelveabort(ui, repo, state, opts): |
|
462 | def unshelveabort(ui, repo, state, opts): | |
463 | """subcommand that abort an in-progress unshelve""" |
|
463 | """subcommand that abort an in-progress unshelve""" | |
464 | wlock = repo.wlock() |
|
464 | wlock = repo.wlock() | |
465 | lock = None |
|
465 | lock = None | |
466 | try: |
|
466 | try: | |
467 | checkparents(repo, state) |
|
467 | checkparents(repo, state) | |
468 |
|
468 | |||
469 | util.rename(repo.join('unshelverebasestate'), |
|
469 | util.rename(repo.join('unshelverebasestate'), | |
470 | repo.join('rebasestate')) |
|
470 | repo.join('rebasestate')) | |
471 | try: |
|
471 | try: | |
472 | rebase.rebase(ui, repo, **{ |
|
472 | rebase.rebase(ui, repo, **{ | |
473 | 'abort' : True |
|
473 | 'abort' : True | |
474 | }) |
|
474 | }) | |
475 | except Exception: |
|
475 | except Exception: | |
476 | util.rename(repo.join('rebasestate'), |
|
476 | util.rename(repo.join('rebasestate'), | |
477 | repo.join('unshelverebasestate')) |
|
477 | repo.join('unshelverebasestate')) | |
478 | raise |
|
478 | raise | |
479 |
|
479 | |||
480 | lock = repo.lock() |
|
480 | lock = repo.lock() | |
481 |
|
481 | |||
482 | mergefiles(ui, repo, state.wctx, state.pendingctx) |
|
482 | mergefiles(ui, repo, state.wctx, state.pendingctx) | |
483 |
|
483 | |||
484 | repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') |
|
484 | repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') | |
485 | shelvedstate.clear(repo) |
|
485 | shelvedstate.clear(repo) | |
486 | ui.warn(_("unshelve of '%s' aborted\n") % state.name) |
|
486 | ui.warn(_("unshelve of '%s' aborted\n") % state.name) | |
487 | finally: |
|
487 | finally: | |
488 | lockmod.release(lock, wlock) |
|
488 | lockmod.release(lock, wlock) | |
489 |
|
489 | |||
490 | def mergefiles(ui, repo, wctx, shelvectx): |
|
490 | def mergefiles(ui, repo, wctx, shelvectx): | |
491 | """updates to wctx and merges the changes from shelvectx into the |
|
491 | """updates to wctx and merges the changes from shelvectx into the | |
492 | dirstate.""" |
|
492 | dirstate.""" | |
493 | oldquiet = ui.quiet |
|
493 | oldquiet = ui.quiet | |
494 | try: |
|
494 | try: | |
495 | ui.quiet = True |
|
495 | ui.quiet = True | |
496 | hg.update(repo, wctx.node()) |
|
496 | hg.update(repo, wctx.node()) | |
497 | files = [] |
|
497 | files = [] | |
498 | files.extend(shelvectx.files()) |
|
498 | files.extend(shelvectx.files()) | |
499 | files.extend(shelvectx.parents()[0].files()) |
|
499 | files.extend(shelvectx.parents()[0].files()) | |
500 |
|
500 | |||
501 | # revert will overwrite unknown files, so move them out of the way |
|
501 | # revert will overwrite unknown files, so move them out of the way | |
502 | for file in repo.status(unknown=True).unknown: |
|
502 | for file in repo.status(unknown=True).unknown: | |
503 | if file in files: |
|
503 | if file in files: | |
504 | util.rename(file, file + ".orig") |
|
504 | util.rename(file, file + ".orig") | |
505 | ui.pushbuffer(True) |
|
505 | ui.pushbuffer(True) | |
506 | cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), |
|
506 | cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), | |
507 | *pathtofiles(repo, files), |
|
507 | *pathtofiles(repo, files), | |
508 | **{'no_backup': True}) |
|
508 | **{'no_backup': True}) | |
509 | ui.popbuffer() |
|
509 | ui.popbuffer() | |
510 | finally: |
|
510 | finally: | |
511 | ui.quiet = oldquiet |
|
511 | ui.quiet = oldquiet | |
512 |
|
512 | |||
513 | def unshelvecleanup(ui, repo, name, opts): |
|
513 | def unshelvecleanup(ui, repo, name, opts): | |
514 | """remove related files after an unshelve""" |
|
514 | """remove related files after an unshelve""" | |
515 | if not opts['keep']: |
|
515 | if not opts['keep']: | |
516 | for filetype in 'hg patch'.split(): |
|
516 | for filetype in 'hg patch'.split(): | |
517 | shelvedfile(repo, name, filetype).movetobackup() |
|
517 | shelvedfile(repo, name, filetype).movetobackup() | |
518 | cleanupoldbackups(repo) |
|
518 | cleanupoldbackups(repo) | |
519 |
|
519 | |||
520 | def unshelvecontinue(ui, repo, state, opts): |
|
520 | def unshelvecontinue(ui, repo, state, opts): | |
521 | """subcommand to continue an in-progress unshelve""" |
|
521 | """subcommand to continue an in-progress unshelve""" | |
522 | # We're finishing off a merge. First parent is our original |
|
522 | # We're finishing off a merge. First parent is our original | |
523 | # parent, second is the temporary "fake" commit we're unshelving. |
|
523 | # parent, second is the temporary "fake" commit we're unshelving. | |
524 | wlock = repo.wlock() |
|
524 | wlock = repo.wlock() | |
525 | lock = None |
|
525 | lock = None | |
526 | try: |
|
526 | try: | |
527 | checkparents(repo, state) |
|
527 | checkparents(repo, state) | |
528 | ms = merge.mergestate(repo) |
|
528 | ms = merge.mergestate(repo) | |
529 | if [f for f in ms if ms[f] == 'u']: |
|
529 | if [f for f in ms if ms[f] == 'u']: | |
530 | raise error.Abort( |
|
530 | raise error.Abort( | |
531 | _("unresolved conflicts, can't continue"), |
|
531 | _("unresolved conflicts, can't continue"), | |
532 | hint=_("see 'hg resolve', then 'hg unshelve --continue'")) |
|
532 | hint=_("see 'hg resolve', then 'hg unshelve --continue'")) | |
533 |
|
533 | |||
534 | lock = repo.lock() |
|
534 | lock = repo.lock() | |
535 |
|
535 | |||
536 | util.rename(repo.join('unshelverebasestate'), |
|
536 | util.rename(repo.join('unshelverebasestate'), | |
537 | repo.join('rebasestate')) |
|
537 | repo.join('rebasestate')) | |
538 | try: |
|
538 | try: | |
539 | rebase.rebase(ui, repo, **{ |
|
539 | rebase.rebase(ui, repo, **{ | |
540 | 'continue' : True |
|
540 | 'continue' : True | |
541 | }) |
|
541 | }) | |
542 | except Exception: |
|
542 | except Exception: | |
543 | util.rename(repo.join('rebasestate'), |
|
543 | util.rename(repo.join('rebasestate'), | |
544 | repo.join('unshelverebasestate')) |
|
544 | repo.join('unshelverebasestate')) | |
545 | raise |
|
545 | raise | |
546 |
|
546 | |||
547 | shelvectx = repo['tip'] |
|
547 | shelvectx = repo['tip'] | |
548 | if not shelvectx in state.pendingctx.children(): |
|
548 | if not shelvectx in state.pendingctx.children(): | |
549 | # rebase was a no-op, so it produced no child commit |
|
549 | # rebase was a no-op, so it produced no child commit | |
550 | shelvectx = state.pendingctx |
|
550 | shelvectx = state.pendingctx | |
551 | else: |
|
551 | else: | |
552 | # only strip the shelvectx if the rebase produced it |
|
552 | # only strip the shelvectx if the rebase produced it | |
553 | state.stripnodes.append(shelvectx.node()) |
|
553 | state.stripnodes.append(shelvectx.node()) | |
554 |
|
554 | |||
555 | mergefiles(ui, repo, state.wctx, shelvectx) |
|
555 | mergefiles(ui, repo, state.wctx, shelvectx) | |
556 |
|
556 | |||
557 | repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') |
|
557 | repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') | |
558 | shelvedstate.clear(repo) |
|
558 | shelvedstate.clear(repo) | |
559 | unshelvecleanup(ui, repo, state.name, opts) |
|
559 | unshelvecleanup(ui, repo, state.name, opts) | |
560 | ui.status(_("unshelve of '%s' complete\n") % state.name) |
|
560 | ui.status(_("unshelve of '%s' complete\n") % state.name) | |
561 | finally: |
|
561 | finally: | |
562 | lockmod.release(lock, wlock) |
|
562 | lockmod.release(lock, wlock) | |
563 |
|
563 | |||
564 | @command('unshelve', |
|
564 | @command('unshelve', | |
565 | [('a', 'abort', None, |
|
565 | [('a', 'abort', None, | |
566 | _('abort an incomplete unshelve operation')), |
|
566 | _('abort an incomplete unshelve operation')), | |
567 | ('c', 'continue', None, |
|
567 | ('c', 'continue', None, | |
568 | _('continue an incomplete unshelve operation')), |
|
568 | _('continue an incomplete unshelve operation')), | |
569 | ('', 'keep', None, |
|
569 | ('', 'keep', None, | |
570 | _('keep shelve after unshelving')), |
|
570 | _('keep shelve after unshelving')), | |
571 | ('', 'date', '', |
|
571 | ('', 'date', '', | |
572 | _('set date for temporary commits (DEPRECATED)'), _('DATE'))], |
|
572 | _('set date for temporary commits (DEPRECATED)'), _('DATE'))], | |
573 | _('hg unshelve [SHELVED]')) |
|
573 | _('hg unshelve [SHELVED]')) | |
574 | def unshelve(ui, repo, *shelved, **opts): |
|
574 | def unshelve(ui, repo, *shelved, **opts): | |
575 | """restore a shelved change to the working directory |
|
575 | """restore a shelved change to the working directory | |
576 |
|
576 | |||
577 | This command accepts an optional name of a shelved change to |
|
577 | This command accepts an optional name of a shelved change to | |
578 | restore. If none is given, the most recent shelved change is used. |
|
578 | restore. If none is given, the most recent shelved change is used. | |
579 |
|
579 | |||
580 | If a shelved change is applied successfully, the bundle that |
|
580 | If a shelved change is applied successfully, the bundle that | |
581 | contains the shelved changes is moved to a backup location |
|
581 | contains the shelved changes is moved to a backup location | |
582 | (.hg/shelve-backup). |
|
582 | (.hg/shelve-backup). | |
583 |
|
583 | |||
584 | Since you can restore a shelved change on top of an arbitrary |
|
584 | Since you can restore a shelved change on top of an arbitrary | |
585 | commit, it is possible that unshelving will result in a conflict |
|
585 | commit, it is possible that unshelving will result in a conflict | |
586 | between your changes and the commits you are unshelving onto. If |
|
586 | between your changes and the commits you are unshelving onto. If | |
587 | this occurs, you must resolve the conflict, then use |
|
587 | this occurs, you must resolve the conflict, then use | |
588 | ``--continue`` to complete the unshelve operation. (The bundle |
|
588 | ``--continue`` to complete the unshelve operation. (The bundle | |
589 | will not be moved until you successfully complete the unshelve.) |
|
589 | will not be moved until you successfully complete the unshelve.) | |
590 |
|
590 | |||
591 | (Alternatively, you can use ``--abort`` to abandon an unshelve |
|
591 | (Alternatively, you can use ``--abort`` to abandon an unshelve | |
592 | that causes a conflict. This reverts the unshelved changes, and |
|
592 | that causes a conflict. This reverts the unshelved changes, and | |
593 | leaves the bundle in place.) |
|
593 | leaves the bundle in place.) | |
594 |
|
594 | |||
595 | After a successful unshelve, the shelved changes are stored in a |
|
595 | After a successful unshelve, the shelved changes are stored in a | |
596 | backup directory. Only the N most recent backups are kept. N |
|
596 | backup directory. Only the N most recent backups are kept. N | |
597 | defaults to 10 but can be overridden using the ``shelve.maxbackups`` |
|
597 | defaults to 10 but can be overridden using the ``shelve.maxbackups`` | |
598 | configuration option. |
|
598 | configuration option. | |
599 |
|
599 | |||
600 | .. container:: verbose |
|
600 | .. container:: verbose | |
601 |
|
601 | |||
602 | Timestamp in seconds is used to decide order of backups. More |
|
602 | Timestamp in seconds is used to decide order of backups. More | |
603 | than ``maxbackups`` backups are kept, if same timestamp |
|
603 | than ``maxbackups`` backups are kept, if same timestamp | |
604 | prevents from deciding exact order of them, for safety. |
|
604 | prevents from deciding exact order of them, for safety. | |
605 | """ |
|
605 | """ | |
606 | abortf = opts['abort'] |
|
606 | abortf = opts['abort'] | |
607 | continuef = opts['continue'] |
|
607 | continuef = opts['continue'] | |
608 | if not abortf and not continuef: |
|
608 | if not abortf and not continuef: | |
609 | cmdutil.checkunfinished(repo) |
|
609 | cmdutil.checkunfinished(repo) | |
610 |
|
610 | |||
611 | if abortf or continuef: |
|
611 | if abortf or continuef: | |
612 | if abortf and continuef: |
|
612 | if abortf and continuef: | |
613 | raise error.Abort(_('cannot use both abort and continue')) |
|
613 | raise error.Abort(_('cannot use both abort and continue')) | |
614 | if shelved: |
|
614 | if shelved: | |
615 | raise error.Abort(_('cannot combine abort/continue with ' |
|
615 | raise error.Abort(_('cannot combine abort/continue with ' | |
616 | 'naming a shelved change')) |
|
616 | 'naming a shelved change')) | |
617 |
|
617 | |||
618 | try: |
|
618 | try: | |
619 | state = shelvedstate.load(repo) |
|
619 | state = shelvedstate.load(repo) | |
620 | except IOError as err: |
|
620 | except IOError as err: | |
621 | if err.errno != errno.ENOENT: |
|
621 | if err.errno != errno.ENOENT: | |
622 | raise |
|
622 | raise | |
623 | raise error.Abort(_('no unshelve operation underway')) |
|
623 | raise error.Abort(_('no unshelve operation underway')) | |
624 |
|
624 | |||
625 | if abortf: |
|
625 | if abortf: | |
626 | return unshelveabort(ui, repo, state, opts) |
|
626 | return unshelveabort(ui, repo, state, opts) | |
627 | elif continuef: |
|
627 | elif continuef: | |
628 | return unshelvecontinue(ui, repo, state, opts) |
|
628 | return unshelvecontinue(ui, repo, state, opts) | |
629 | elif len(shelved) > 1: |
|
629 | elif len(shelved) > 1: | |
630 | raise error.Abort(_('can only unshelve one change at a time')) |
|
630 | raise error.Abort(_('can only unshelve one change at a time')) | |
631 | elif not shelved: |
|
631 | elif not shelved: | |
632 | shelved = listshelves(repo) |
|
632 | shelved = listshelves(repo) | |
633 | if not shelved: |
|
633 | if not shelved: | |
634 | raise error.Abort(_('no shelved changes to apply!')) |
|
634 | raise error.Abort(_('no shelved changes to apply!')) | |
635 | basename = util.split(shelved[0][1])[1] |
|
635 | basename = util.split(shelved[0][1])[1] | |
636 | ui.status(_("unshelving change '%s'\n") % basename) |
|
636 | ui.status(_("unshelving change '%s'\n") % basename) | |
637 | else: |
|
637 | else: | |
638 | basename = shelved[0] |
|
638 | basename = shelved[0] | |
639 |
|
639 | |||
640 | if not shelvedfile(repo, basename, 'patch').exists(): |
|
640 | if not shelvedfile(repo, basename, 'patch').exists(): | |
641 | raise error.Abort(_("shelved change '%s' not found") % basename) |
|
641 | raise error.Abort(_("shelved change '%s' not found") % basename) | |
642 |
|
642 | |||
643 | oldquiet = ui.quiet |
|
643 | oldquiet = ui.quiet | |
644 | wlock = lock = tr = None |
|
644 | wlock = lock = tr = None | |
645 | try: |
|
645 | try: | |
646 | wlock = repo.wlock() |
|
646 | wlock = repo.wlock() | |
647 | lock = repo.lock() |
|
647 | lock = repo.lock() | |
648 |
|
648 | |||
649 | tr = repo.transaction('unshelve', report=lambda x: None) |
|
649 | tr = repo.transaction('unshelve', report=lambda x: None) | |
650 | oldtiprev = len(repo) |
|
650 | oldtiprev = len(repo) | |
651 |
|
651 | |||
652 | pctx = repo['.'] |
|
652 | pctx = repo['.'] | |
653 | tmpwctx = pctx |
|
653 | tmpwctx = pctx | |
654 | # The goal is to have a commit structure like so: |
|
654 | # The goal is to have a commit structure like so: | |
655 | # ...-> pctx -> tmpwctx -> shelvectx |
|
655 | # ...-> pctx -> tmpwctx -> shelvectx | |
656 | # where tmpwctx is an optional commit with the user's pending changes |
|
656 | # where tmpwctx is an optional commit with the user's pending changes | |
657 | # and shelvectx is the unshelved changes. Then we merge it all down |
|
657 | # and shelvectx is the unshelved changes. Then we merge it all down | |
658 | # to the original pctx. |
|
658 | # to the original pctx. | |
659 |
|
659 | |||
660 | # Store pending changes in a commit |
|
660 | # Store pending changes in a commit | |
661 | s = repo.status() |
|
661 | s = repo.status() | |
662 | if s.modified or s.added or s.removed or s.deleted: |
|
662 | if s.modified or s.added or s.removed or s.deleted: | |
663 | ui.status(_("temporarily committing pending changes " |
|
663 | ui.status(_("temporarily committing pending changes " | |
664 | "(restore with 'hg unshelve --abort')\n")) |
|
664 | "(restore with 'hg unshelve --abort')\n")) | |
665 | def commitfunc(ui, repo, message, match, opts): |
|
665 | def commitfunc(ui, repo, message, match, opts): | |
666 | hasmq = util.safehasattr(repo, 'mq') |
|
666 | hasmq = util.safehasattr(repo, 'mq') | |
667 | if hasmq: |
|
667 | if hasmq: | |
668 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False |
|
668 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False | |
669 |
|
669 | |||
670 | backup = repo.ui.backupconfig('phases', 'new-commit') |
|
670 | backup = repo.ui.backupconfig('phases', 'new-commit') | |
671 | try: |
|
671 | try: | |
672 | repo.ui. setconfig('phases', 'new-commit', phases.secret) |
|
672 | repo.ui. setconfig('phases', 'new-commit', phases.secret) | |
673 | return repo.commit(message, 'shelve@localhost', |
|
673 | return repo.commit(message, 'shelve@localhost', | |
674 | opts.get('date'), match) |
|
674 | opts.get('date'), match) | |
675 | finally: |
|
675 | finally: | |
676 | repo.ui.restoreconfig(backup) |
|
676 | repo.ui.restoreconfig(backup) | |
677 | if hasmq: |
|
677 | if hasmq: | |
678 | repo.mq.checkapplied = saved |
|
678 | repo.mq.checkapplied = saved | |
679 |
|
679 | |||
680 | tempopts = {} |
|
680 | tempopts = {} | |
681 | tempopts['message'] = "pending changes temporary commit" |
|
681 | tempopts['message'] = "pending changes temporary commit" | |
682 | tempopts['date'] = opts.get('date') |
|
682 | tempopts['date'] = opts.get('date') | |
683 | ui.quiet = True |
|
683 | ui.quiet = True | |
684 | node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) |
|
684 | node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) | |
685 | tmpwctx = repo[node] |
|
685 | tmpwctx = repo[node] | |
686 |
|
686 | |||
687 | ui.quiet = True |
|
687 | ui.quiet = True | |
688 | shelvedfile(repo, basename, 'hg').applybundle() |
|
688 | shelvedfile(repo, basename, 'hg').applybundle() | |
689 |
|
689 | |||
690 | ui.quiet = oldquiet |
|
690 | ui.quiet = oldquiet | |
691 |
|
691 | |||
692 | shelvectx = repo['tip'] |
|
692 | shelvectx = repo['tip'] | |
693 |
|
693 | |||
694 | # If the shelve is not immediately on top of the commit |
|
694 | # If the shelve is not immediately on top of the commit | |
695 | # we'll be merging with, rebase it to be on top. |
|
695 | # we'll be merging with, rebase it to be on top. | |
696 | if tmpwctx.node() != shelvectx.parents()[0].node(): |
|
696 | if tmpwctx.node() != shelvectx.parents()[0].node(): | |
697 | ui.status(_('rebasing shelved changes\n')) |
|
697 | ui.status(_('rebasing shelved changes\n')) | |
698 | try: |
|
698 | try: | |
699 | rebase.rebase(ui, repo, **{ |
|
699 | rebase.rebase(ui, repo, **{ | |
700 | 'rev' : [shelvectx.rev()], |
|
700 | 'rev' : [shelvectx.rev()], | |
701 | 'dest' : str(tmpwctx.rev()), |
|
701 | 'dest' : str(tmpwctx.rev()), | |
702 | 'keep' : True, |
|
702 | 'keep' : True, | |
703 | }) |
|
703 | }) | |
704 | except error.InterventionRequired: |
|
704 | except error.InterventionRequired: | |
705 | tr.close() |
|
705 | tr.close() | |
706 |
|
706 | |||
707 | stripnodes = [repo.changelog.node(rev) |
|
707 | stripnodes = [repo.changelog.node(rev) | |
708 | for rev in xrange(oldtiprev, len(repo))] |
|
708 | for rev in xrange(oldtiprev, len(repo))] | |
709 | shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes) |
|
709 | shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes) | |
710 |
|
710 | |||
711 | util.rename(repo.join('rebasestate'), |
|
711 | util.rename(repo.join('rebasestate'), | |
712 | repo.join('unshelverebasestate')) |
|
712 | repo.join('unshelverebasestate')) | |
713 | raise error.InterventionRequired( |
|
713 | raise error.InterventionRequired( | |
714 | _("unresolved conflicts (see 'hg resolve', then " |
|
714 | _("unresolved conflicts (see 'hg resolve', then " | |
715 | "'hg unshelve --continue')")) |
|
715 | "'hg unshelve --continue')")) | |
716 |
|
716 | |||
717 | # refresh ctx after rebase completes |
|
717 | # refresh ctx after rebase completes | |
718 | shelvectx = repo['tip'] |
|
718 | shelvectx = repo['tip'] | |
719 |
|
719 | |||
720 | if not shelvectx in tmpwctx.children(): |
|
720 | if not shelvectx in tmpwctx.children(): | |
721 | # rebase was a no-op, so it produced no child commit |
|
721 | # rebase was a no-op, so it produced no child commit | |
722 | shelvectx = tmpwctx |
|
722 | shelvectx = tmpwctx | |
723 |
|
723 | |||
724 | mergefiles(ui, repo, pctx, shelvectx) |
|
724 | mergefiles(ui, repo, pctx, shelvectx) | |
725 | shelvedstate.clear(repo) |
|
725 | shelvedstate.clear(repo) | |
726 |
|
726 | |||
727 | # The transaction aborting will strip all the commits for us, |
|
727 | # The transaction aborting will strip all the commits for us, | |
728 | # but it doesn't update the inmemory structures, so addchangegroup |
|
728 | # but it doesn't update the inmemory structures, so addchangegroup | |
729 | # hooks still fire and try to operate on the missing commits. |
|
729 | # hooks still fire and try to operate on the missing commits. | |
730 | # Clean up manually to prevent this. |
|
730 | # Clean up manually to prevent this. | |
731 | repo.unfiltered().changelog.strip(oldtiprev, tr) |
|
731 | repo.unfiltered().changelog.strip(oldtiprev, tr) | |
732 |
|
732 | |||
733 | unshelvecleanup(ui, repo, basename, opts) |
|
733 | unshelvecleanup(ui, repo, basename, opts) | |
734 |
|
734 | |||
735 | _aborttransaction(repo) |
|
735 | _aborttransaction(repo) | |
736 | finally: |
|
736 | finally: | |
737 | ui.quiet = oldquiet |
|
737 | ui.quiet = oldquiet | |
738 | if tr: |
|
738 | if tr: | |
739 | tr.release() |
|
739 | tr.release() | |
740 | lockmod.release(lock, wlock) |
|
740 | lockmod.release(lock, wlock) | |
741 |
|
741 | |||
742 | @command('shelve', |
|
742 | @command('shelve', | |
743 | [('A', 'addremove', None, |
|
743 | [('A', 'addremove', None, | |
744 | _('mark new/missing files as added/removed before shelving')), |
|
744 | _('mark new/missing files as added/removed before shelving')), | |
745 | ('', 'cleanup', None, |
|
745 | ('', 'cleanup', None, | |
746 | _('delete all shelved changes')), |
|
746 | _('delete all shelved changes')), | |
747 | ('', 'date', '', |
|
747 | ('', 'date', '', | |
748 | _('shelve with the specified commit date'), _('DATE')), |
|
748 | _('shelve with the specified commit date'), _('DATE')), | |
749 | ('d', 'delete', None, |
|
749 | ('d', 'delete', None, | |
750 | _('delete the named shelved change(s)')), |
|
750 | _('delete the named shelved change(s)')), | |
751 | ('e', 'edit', False, |
|
751 | ('e', 'edit', False, | |
752 | _('invoke editor on commit messages')), |
|
752 | _('invoke editor on commit messages')), | |
753 | ('l', 'list', None, |
|
753 | ('l', 'list', None, | |
754 | _('list current shelves')), |
|
754 | _('list current shelves')), | |
755 | ('m', 'message', '', |
|
755 | ('m', 'message', '', | |
756 | _('use text as shelve message'), _('TEXT')), |
|
756 | _('use text as shelve message'), _('TEXT')), | |
757 | ('n', 'name', '', |
|
757 | ('n', 'name', '', | |
758 | _('use the given name for the shelved commit'), _('NAME')), |
|
758 | _('use the given name for the shelved commit'), _('NAME')), | |
759 | ('p', 'patch', None, |
|
759 | ('p', 'patch', None, | |
760 | _('show patch')), |
|
760 | _('show patch')), | |
761 | ('i', 'interactive', None, |
|
761 | ('i', 'interactive', None, | |
762 | _('interactive mode, only works while creating a shelve')), |
|
762 | _('interactive mode, only works while creating a shelve')), | |
763 | ('', 'stat', None, |
|
763 | ('', 'stat', None, | |
764 | _('output diffstat-style summary of changes'))] + commands.walkopts, |
|
764 | _('output diffstat-style summary of changes'))] + commands.walkopts, | |
765 | _('hg shelve [OPTION]... [FILE]...')) |
|
765 | _('hg shelve [OPTION]... [FILE]...')) | |
766 | def shelvecmd(ui, repo, *pats, **opts): |
|
766 | def shelvecmd(ui, repo, *pats, **opts): | |
767 | '''save and set aside changes from the working directory |
|
767 | '''save and set aside changes from the working directory | |
768 |
|
768 | |||
769 | Shelving takes files that "hg status" reports as not clean, saves |
|
769 | Shelving takes files that "hg status" reports as not clean, saves | |
770 | the modifications to a bundle (a shelved change), and reverts the |
|
770 | the modifications to a bundle (a shelved change), and reverts the | |
771 | files so that their state in the working directory becomes clean. |
|
771 | files so that their state in the working directory becomes clean. | |
772 |
|
772 | |||
773 | To restore these changes to the working directory, using "hg |
|
773 | To restore these changes to the working directory, using "hg | |
774 | unshelve"; this will work even if you switch to a different |
|
774 | unshelve"; this will work even if you switch to a different | |
775 | commit. |
|
775 | commit. | |
776 |
|
776 | |||
777 | When no files are specified, "hg shelve" saves all not-clean |
|
777 | When no files are specified, "hg shelve" saves all not-clean | |
778 | files. If specific files or directories are named, only changes to |
|
778 | files. If specific files or directories are named, only changes to | |
779 | those files are shelved. |
|
779 | those files are shelved. | |
780 |
|
780 | |||
781 | Each shelved change has a name that makes it easier to find later. |
|
781 | Each shelved change has a name that makes it easier to find later. | |
782 | The name of a shelved change defaults to being based on the active |
|
782 | The name of a shelved change defaults to being based on the active | |
783 | bookmark, or if there is no active bookmark, the current named |
|
783 | bookmark, or if there is no active bookmark, the current named | |
784 | branch. To specify a different name, use ``--name``. |
|
784 | branch. To specify a different name, use ``--name``. | |
785 |
|
785 | |||
786 | To see a list of existing shelved changes, use the ``--list`` |
|
786 | To see a list of existing shelved changes, use the ``--list`` | |
787 | option. For each shelved change, this will print its name, age, |
|
787 | option. For each shelved change, this will print its name, age, | |
788 | and description; use ``--patch`` or ``--stat`` for more details. |
|
788 | and description; use ``--patch`` or ``--stat`` for more details. | |
789 |
|
789 | |||
790 | To delete specific shelved changes, use ``--delete``. To delete |
|
790 | To delete specific shelved changes, use ``--delete``. To delete | |
791 | all shelved changes, use ``--cleanup``. |
|
791 | all shelved changes, use ``--cleanup``. | |
792 | ''' |
|
792 | ''' | |
793 | cmdutil.checkunfinished(repo) |
|
793 | cmdutil.checkunfinished(repo) | |
794 |
|
794 | |||
795 | allowables = [ |
|
795 | allowables = [ | |
796 | ('addremove', set(['create'])), # 'create' is pseudo action |
|
796 | ('addremove', set(['create'])), # 'create' is pseudo action | |
797 | ('cleanup', set(['cleanup'])), |
|
797 | ('cleanup', set(['cleanup'])), | |
798 | # ('date', set(['create'])), # ignored for passing '--date "0 0"' in tests |
|
798 | # ('date', set(['create'])), # ignored for passing '--date "0 0"' in tests | |
799 | ('delete', set(['delete'])), |
|
799 | ('delete', set(['delete'])), | |
800 | ('edit', set(['create'])), |
|
800 | ('edit', set(['create'])), | |
801 | ('list', set(['list'])), |
|
801 | ('list', set(['list'])), | |
802 | ('message', set(['create'])), |
|
802 | ('message', set(['create'])), | |
803 | ('name', set(['create'])), |
|
803 | ('name', set(['create'])), | |
804 | ('patch', set(['patch', 'list'])), |
|
804 | ('patch', set(['patch', 'list'])), | |
805 | ('stat', set(['stat', 'list'])), |
|
805 | ('stat', set(['stat', 'list'])), | |
806 | ] |
|
806 | ] | |
807 | def checkopt(opt): |
|
807 | def checkopt(opt): | |
808 | if opts[opt]: |
|
808 | if opts[opt]: | |
809 | for i, allowable in allowables: |
|
809 | for i, allowable in allowables: | |
810 | if opts[i] and opt not in allowable: |
|
810 | if opts[i] and opt not in allowable: | |
811 | raise error.Abort(_("options '--%s' and '--%s' may not be " |
|
811 | raise error.Abort(_("options '--%s' and '--%s' may not be " | |
812 | "used together") % (opt, i)) |
|
812 | "used together") % (opt, i)) | |
813 | return True |
|
813 | return True | |
814 | if checkopt('cleanup'): |
|
814 | if checkopt('cleanup'): | |
815 | if pats: |
|
815 | if pats: | |
816 | raise error.Abort(_("cannot specify names when using '--cleanup'")) |
|
816 | raise error.Abort(_("cannot specify names when using '--cleanup'")) | |
817 | return cleanupcmd(ui, repo) |
|
817 | return cleanupcmd(ui, repo) | |
818 | elif checkopt('delete'): |
|
818 | elif checkopt('delete'): | |
819 | return deletecmd(ui, repo, pats) |
|
819 | return deletecmd(ui, repo, pats) | |
820 | elif checkopt('list'): |
|
820 | elif checkopt('list'): | |
821 | return listcmd(ui, repo, pats, opts) |
|
821 | return listcmd(ui, repo, pats, opts) | |
822 | elif checkopt('patch'): |
|
822 | elif checkopt('patch'): | |
823 | return singlepatchcmds(ui, repo, pats, opts, subcommand='patch') |
|
823 | return singlepatchcmds(ui, repo, pats, opts, subcommand='patch') | |
824 | elif checkopt('stat'): |
|
824 | elif checkopt('stat'): | |
825 | return singlepatchcmds(ui, repo, pats, opts, subcommand='stat') |
|
825 | return singlepatchcmds(ui, repo, pats, opts, subcommand='stat') | |
826 | else: |
|
826 | else: | |
827 | return createcmd(ui, repo, pats, opts) |
|
827 | return createcmd(ui, repo, pats, opts) | |
828 |
|
828 | |||
829 | def extsetup(ui): |
|
829 | def extsetup(ui): | |
830 | cmdutil.unfinishedstates.append( |
|
830 | cmdutil.unfinishedstates.append( | |
831 | [shelvedstate._filename, False, False, |
|
831 | [shelvedstate._filename, False, False, | |
832 | _('unshelve already in progress'), |
|
832 | _('unshelve already in progress'), | |
833 | _("use 'hg unshelve --continue' or 'hg unshelve --abort'")]) |
|
833 | _("use 'hg unshelve --continue' or 'hg unshelve --abort'")]) |
General Comments 0
You need to be logged in to leave comments.
Login now