Show More
@@ -1,908 +1,927 | |||||
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 | from __future__ import absolute_import |
|
23 | from __future__ import absolute_import | |
24 |
|
24 | |||
25 | import collections |
|
25 | import collections | |
26 | import errno |
|
26 | import errno | |
27 | import itertools |
|
27 | import itertools | |
28 |
|
28 | |||
29 | from mercurial.i18n import _ |
|
29 | from mercurial.i18n import _ | |
30 | from mercurial import ( |
|
30 | from mercurial import ( | |
31 | bundle2, |
|
31 | bundle2, | |
32 | bundlerepo, |
|
32 | bundlerepo, | |
33 | changegroup, |
|
33 | changegroup, | |
34 | cmdutil, |
|
34 | cmdutil, | |
35 | commands, |
|
35 | commands, | |
36 | error, |
|
36 | error, | |
37 | exchange, |
|
37 | exchange, | |
38 | hg, |
|
38 | hg, | |
39 | lock as lockmod, |
|
39 | lock as lockmod, | |
40 | mdiff, |
|
40 | mdiff, | |
41 | merge, |
|
41 | merge, | |
42 | node as nodemod, |
|
42 | node as nodemod, | |
43 | patch, |
|
43 | patch, | |
44 | phases, |
|
44 | phases, | |
45 | repair, |
|
45 | repair, | |
46 | scmutil, |
|
46 | scmutil, | |
47 | templatefilters, |
|
47 | templatefilters, | |
48 | util, |
|
48 | util, | |
49 | ) |
|
49 | ) | |
50 |
|
50 | |||
51 | from . import ( |
|
51 | from . import ( | |
52 | rebase, |
|
52 | rebase, | |
53 | ) |
|
53 | ) | |
54 |
|
54 | |||
55 | cmdtable = {} |
|
55 | cmdtable = {} | |
56 | command = cmdutil.command(cmdtable) |
|
56 | command = cmdutil.command(cmdtable) | |
57 | # Note for extension authors: ONLY specify testedwith = 'internal' for |
|
57 | # Note for extension authors: ONLY specify testedwith = 'internal' for | |
58 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
58 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
59 | # be specifying the version(s) of Mercurial they are tested with, or |
|
59 | # be specifying the version(s) of Mercurial they are tested with, or | |
60 | # leave the attribute unspecified. |
|
60 | # leave the attribute unspecified. | |
61 | testedwith = 'internal' |
|
61 | testedwith = 'internal' | |
62 |
|
62 | |||
63 | backupdir = 'shelve-backup' |
|
63 | backupdir = 'shelve-backup' | |
64 | shelvedir = 'shelved' |
|
64 | shelvedir = 'shelved' | |
65 |
|
65 | |||
66 | class shelvedfile(object): |
|
66 | class shelvedfile(object): | |
67 | """Helper for the file storing a single shelve |
|
67 | """Helper for the file storing a single shelve | |
68 |
|
68 | |||
69 | Handles common functions on shelve files (.hg/.patch) using |
|
69 | Handles common functions on shelve files (.hg/.patch) using | |
70 | the vfs layer""" |
|
70 | the vfs layer""" | |
71 | def __init__(self, repo, name, filetype=None): |
|
71 | def __init__(self, repo, name, filetype=None): | |
72 | self.repo = repo |
|
72 | self.repo = repo | |
73 | self.name = name |
|
73 | self.name = name | |
74 | self.vfs = scmutil.vfs(repo.join(shelvedir)) |
|
74 | self.vfs = scmutil.vfs(repo.join(shelvedir)) | |
75 | self.backupvfs = scmutil.vfs(repo.join(backupdir)) |
|
75 | self.backupvfs = scmutil.vfs(repo.join(backupdir)) | |
76 | self.ui = self.repo.ui |
|
76 | self.ui = self.repo.ui | |
77 | if filetype: |
|
77 | if filetype: | |
78 | self.fname = name + '.' + filetype |
|
78 | self.fname = name + '.' + filetype | |
79 | else: |
|
79 | else: | |
80 | self.fname = name |
|
80 | self.fname = name | |
81 |
|
81 | |||
82 | def exists(self): |
|
82 | def exists(self): | |
83 | return self.vfs.exists(self.fname) |
|
83 | return self.vfs.exists(self.fname) | |
84 |
|
84 | |||
85 | def filename(self): |
|
85 | def filename(self): | |
86 | return self.vfs.join(self.fname) |
|
86 | return self.vfs.join(self.fname) | |
87 |
|
87 | |||
88 | def backupfilename(self): |
|
88 | def backupfilename(self): | |
89 | def gennames(base): |
|
89 | def gennames(base): | |
90 | yield base |
|
90 | yield base | |
91 | base, ext = base.rsplit('.', 1) |
|
91 | base, ext = base.rsplit('.', 1) | |
92 | for i in itertools.count(1): |
|
92 | for i in itertools.count(1): | |
93 | yield '%s-%d.%s' % (base, i, ext) |
|
93 | yield '%s-%d.%s' % (base, i, ext) | |
94 |
|
94 | |||
95 | name = self.backupvfs.join(self.fname) |
|
95 | name = self.backupvfs.join(self.fname) | |
96 | for n in gennames(name): |
|
96 | for n in gennames(name): | |
97 | if not self.backupvfs.exists(n): |
|
97 | if not self.backupvfs.exists(n): | |
98 | return n |
|
98 | return n | |
99 |
|
99 | |||
100 | def movetobackup(self): |
|
100 | def movetobackup(self): | |
101 | if not self.backupvfs.isdir(): |
|
101 | if not self.backupvfs.isdir(): | |
102 | self.backupvfs.makedir() |
|
102 | self.backupvfs.makedir() | |
103 | util.rename(self.filename(), self.backupfilename()) |
|
103 | util.rename(self.filename(), self.backupfilename()) | |
104 |
|
104 | |||
105 | def stat(self): |
|
105 | def stat(self): | |
106 | return self.vfs.stat(self.fname) |
|
106 | return self.vfs.stat(self.fname) | |
107 |
|
107 | |||
108 | def opener(self, mode='rb'): |
|
108 | def opener(self, mode='rb'): | |
109 | try: |
|
109 | try: | |
110 | return self.vfs(self.fname, mode) |
|
110 | return self.vfs(self.fname, mode) | |
111 | except IOError as err: |
|
111 | except IOError as err: | |
112 | if err.errno != errno.ENOENT: |
|
112 | if err.errno != errno.ENOENT: | |
113 | raise |
|
113 | raise | |
114 | raise error.Abort(_("shelved change '%s' not found") % self.name) |
|
114 | raise error.Abort(_("shelved change '%s' not found") % self.name) | |
115 |
|
115 | |||
116 | def applybundle(self): |
|
116 | def applybundle(self): | |
117 | fp = self.opener() |
|
117 | fp = self.opener() | |
118 | try: |
|
118 | try: | |
119 | gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) |
|
119 | gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) | |
120 | if not isinstance(gen, bundle2.unbundle20): |
|
120 | if not isinstance(gen, bundle2.unbundle20): | |
121 | gen.apply(self.repo, 'unshelve', |
|
121 | gen.apply(self.repo, 'unshelve', | |
122 | 'bundle:' + self.vfs.join(self.fname), |
|
122 | 'bundle:' + self.vfs.join(self.fname), | |
123 | targetphase=phases.secret) |
|
123 | targetphase=phases.secret) | |
124 | if isinstance(gen, bundle2.unbundle20): |
|
124 | if isinstance(gen, bundle2.unbundle20): | |
125 | bundle2.applybundle(self.repo, gen, |
|
125 | bundle2.applybundle(self.repo, gen, | |
126 | self.repo.currenttransaction(), |
|
126 | self.repo.currenttransaction(), | |
127 | source='unshelve', |
|
127 | source='unshelve', | |
128 | url='bundle:' + self.vfs.join(self.fname)) |
|
128 | url='bundle:' + self.vfs.join(self.fname)) | |
129 | finally: |
|
129 | finally: | |
130 | fp.close() |
|
130 | fp.close() | |
131 |
|
131 | |||
132 | def bundlerepo(self): |
|
132 | def bundlerepo(self): | |
133 | return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, |
|
133 | return bundlerepo.bundlerepository(self.repo.baseui, self.repo.root, | |
134 | self.vfs.join(self.fname)) |
|
134 | self.vfs.join(self.fname)) | |
135 | def writebundle(self, bases, node): |
|
135 | def writebundle(self, bases, node): | |
136 | cgversion = changegroup.safeversion(self.repo) |
|
136 | cgversion = changegroup.safeversion(self.repo) | |
137 | if cgversion == '01': |
|
137 | if cgversion == '01': | |
138 | btype = 'HG10BZ' |
|
138 | btype = 'HG10BZ' | |
139 | compression = None |
|
139 | compression = None | |
140 | else: |
|
140 | else: | |
141 | btype = 'HG20' |
|
141 | btype = 'HG20' | |
142 | compression = 'BZ' |
|
142 | compression = 'BZ' | |
143 |
|
143 | |||
144 | cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve', |
|
144 | cg = changegroup.changegroupsubset(self.repo, bases, [node], 'shelve', | |
145 | version=cgversion) |
|
145 | version=cgversion) | |
146 | bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs, |
|
146 | bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs, | |
147 | compression=compression) |
|
147 | compression=compression) | |
148 |
|
148 | |||
149 | class shelvedstate(object): |
|
149 | class shelvedstate(object): | |
150 | """Handle persistence during unshelving operations. |
|
150 | """Handle persistence during unshelving operations. | |
151 |
|
151 | |||
152 | Handles saving and restoring a shelved state. Ensures that different |
|
152 | Handles saving and restoring a shelved state. Ensures that different | |
153 | versions of a shelved state are possible and handles them appropriately. |
|
153 | versions of a shelved state are possible and handles them appropriately. | |
154 | """ |
|
154 | """ | |
155 | _version = 1 |
|
155 | _version = 1 | |
156 | _filename = 'shelvedstate' |
|
156 | _filename = 'shelvedstate' | |
157 |
|
157 | |||
158 | @classmethod |
|
158 | @classmethod | |
159 | def load(cls, repo): |
|
159 | def load(cls, repo): | |
160 | fp = repo.vfs(cls._filename) |
|
160 | fp = repo.vfs(cls._filename) | |
161 | try: |
|
161 | try: | |
162 | version = int(fp.readline().strip()) |
|
162 | version = int(fp.readline().strip()) | |
163 |
|
163 | |||
164 | if version != cls._version: |
|
164 | if version != cls._version: | |
165 | raise error.Abort(_('this version of shelve is incompatible ' |
|
165 | raise error.Abort(_('this version of shelve is incompatible ' | |
166 | 'with the version used in this repo')) |
|
166 | 'with the version used in this repo')) | |
167 | name = fp.readline().strip() |
|
167 | name = fp.readline().strip() | |
168 | wctx = fp.readline().strip() |
|
168 | wctx = nodemod.bin(fp.readline().strip()) | |
169 | pendingctx = fp.readline().strip() |
|
169 | pendingctx = nodemod.bin(fp.readline().strip()) | |
170 | parents = [nodemod.bin(h) for h in fp.readline().split()] |
|
170 | parents = [nodemod.bin(h) for h in fp.readline().split()] | |
171 | stripnodes = [nodemod.bin(h) for h in fp.readline().split()] |
|
171 | stripnodes = [nodemod.bin(h) for h in fp.readline().split()] | |
172 | branchtorestore = fp.readline().strip() |
|
172 | branchtorestore = fp.readline().strip() | |
|
173 | except (ValueError, TypeError) as err: | |||
|
174 | raise error.CorruptedState(str(err)) | |||
173 | finally: |
|
175 | finally: | |
174 | fp.close() |
|
176 | fp.close() | |
175 |
|
177 | |||
|
178 | try: | |||
176 | obj = cls() |
|
179 | obj = cls() | |
177 | obj.name = name |
|
180 | obj.name = name | |
178 |
obj.wctx = repo[ |
|
181 | obj.wctx = repo[wctx] | |
179 |
obj.pendingctx = repo[ |
|
182 | obj.pendingctx = repo[pendingctx] | |
180 | obj.parents = parents |
|
183 | obj.parents = parents | |
181 | obj.stripnodes = stripnodes |
|
184 | obj.stripnodes = stripnodes | |
182 | obj.branchtorestore = branchtorestore |
|
185 | obj.branchtorestore = branchtorestore | |
|
186 | except error.RepoLookupError as err: | |||
|
187 | raise error.CorruptedState(str(err)) | |||
183 |
|
188 | |||
184 | return obj |
|
189 | return obj | |
185 |
|
190 | |||
186 | @classmethod |
|
191 | @classmethod | |
187 | def save(cls, repo, name, originalwctx, pendingctx, stripnodes, |
|
192 | def save(cls, repo, name, originalwctx, pendingctx, stripnodes, | |
188 | branchtorestore): |
|
193 | branchtorestore): | |
189 | fp = repo.vfs(cls._filename, 'wb') |
|
194 | fp = repo.vfs(cls._filename, 'wb') | |
190 | fp.write('%i\n' % cls._version) |
|
195 | fp.write('%i\n' % cls._version) | |
191 | fp.write('%s\n' % name) |
|
196 | fp.write('%s\n' % name) | |
192 | fp.write('%s\n' % nodemod.hex(originalwctx.node())) |
|
197 | fp.write('%s\n' % nodemod.hex(originalwctx.node())) | |
193 | fp.write('%s\n' % nodemod.hex(pendingctx.node())) |
|
198 | fp.write('%s\n' % nodemod.hex(pendingctx.node())) | |
194 | fp.write('%s\n' % |
|
199 | fp.write('%s\n' % | |
195 | ' '.join([nodemod.hex(p) for p in repo.dirstate.parents()])) |
|
200 | ' '.join([nodemod.hex(p) for p in repo.dirstate.parents()])) | |
196 | fp.write('%s\n' % |
|
201 | fp.write('%s\n' % | |
197 | ' '.join([nodemod.hex(n) for n in stripnodes])) |
|
202 | ' '.join([nodemod.hex(n) for n in stripnodes])) | |
198 | fp.write('%s\n' % branchtorestore) |
|
203 | fp.write('%s\n' % branchtorestore) | |
199 | fp.close() |
|
204 | fp.close() | |
200 |
|
205 | |||
201 | @classmethod |
|
206 | @classmethod | |
202 | def clear(cls, repo): |
|
207 | def clear(cls, repo): | |
203 | util.unlinkpath(repo.join(cls._filename), ignoremissing=True) |
|
208 | util.unlinkpath(repo.join(cls._filename), ignoremissing=True) | |
204 |
|
209 | |||
205 | def cleanupoldbackups(repo): |
|
210 | def cleanupoldbackups(repo): | |
206 | vfs = scmutil.vfs(repo.join(backupdir)) |
|
211 | vfs = scmutil.vfs(repo.join(backupdir)) | |
207 | maxbackups = repo.ui.configint('shelve', 'maxbackups', 10) |
|
212 | maxbackups = repo.ui.configint('shelve', 'maxbackups', 10) | |
208 | hgfiles = [f for f in vfs.listdir() if f.endswith('.hg')] |
|
213 | hgfiles = [f for f in vfs.listdir() if f.endswith('.hg')] | |
209 | hgfiles = sorted([(vfs.stat(f).st_mtime, f) for f in hgfiles]) |
|
214 | hgfiles = sorted([(vfs.stat(f).st_mtime, f) for f in hgfiles]) | |
210 | if 0 < maxbackups and maxbackups < len(hgfiles): |
|
215 | if 0 < maxbackups and maxbackups < len(hgfiles): | |
211 | bordermtime = hgfiles[-maxbackups][0] |
|
216 | bordermtime = hgfiles[-maxbackups][0] | |
212 | else: |
|
217 | else: | |
213 | bordermtime = None |
|
218 | bordermtime = None | |
214 | for mtime, f in hgfiles[:len(hgfiles) - maxbackups]: |
|
219 | for mtime, f in hgfiles[:len(hgfiles) - maxbackups]: | |
215 | if mtime == bordermtime: |
|
220 | if mtime == bordermtime: | |
216 | # keep it, because timestamp can't decide exact order of backups |
|
221 | # keep it, because timestamp can't decide exact order of backups | |
217 | continue |
|
222 | continue | |
218 | base = f[:-3] |
|
223 | base = f[:-3] | |
219 | for ext in 'hg patch'.split(): |
|
224 | for ext in 'hg patch'.split(): | |
220 | try: |
|
225 | try: | |
221 | vfs.unlink(base + '.' + ext) |
|
226 | vfs.unlink(base + '.' + ext) | |
222 | except OSError as err: |
|
227 | except OSError as err: | |
223 | if err.errno != errno.ENOENT: |
|
228 | if err.errno != errno.ENOENT: | |
224 | raise |
|
229 | raise | |
225 |
|
230 | |||
226 | def _aborttransaction(repo): |
|
231 | def _aborttransaction(repo): | |
227 | '''Abort current transaction for shelve/unshelve, but keep dirstate |
|
232 | '''Abort current transaction for shelve/unshelve, but keep dirstate | |
228 | ''' |
|
233 | ''' | |
229 | tr = repo.currenttransaction() |
|
234 | tr = repo.currenttransaction() | |
230 | repo.dirstate.savebackup(tr, suffix='.shelve') |
|
235 | repo.dirstate.savebackup(tr, suffix='.shelve') | |
231 | tr.abort() |
|
236 | tr.abort() | |
232 | repo.dirstate.restorebackup(None, suffix='.shelve') |
|
237 | repo.dirstate.restorebackup(None, suffix='.shelve') | |
233 |
|
238 | |||
234 | def createcmd(ui, repo, pats, opts): |
|
239 | def createcmd(ui, repo, pats, opts): | |
235 | """subcommand that creates a new shelve""" |
|
240 | """subcommand that creates a new shelve""" | |
236 | with repo.wlock(): |
|
241 | with repo.wlock(): | |
237 | cmdutil.checkunfinished(repo) |
|
242 | cmdutil.checkunfinished(repo) | |
238 | return _docreatecmd(ui, repo, pats, opts) |
|
243 | return _docreatecmd(ui, repo, pats, opts) | |
239 |
|
244 | |||
240 | def _docreatecmd(ui, repo, pats, opts): |
|
245 | def _docreatecmd(ui, repo, pats, opts): | |
241 | def mutableancestors(ctx): |
|
246 | def mutableancestors(ctx): | |
242 | """return all mutable ancestors for ctx (included) |
|
247 | """return all mutable ancestors for ctx (included) | |
243 |
|
248 | |||
244 | Much faster than the revset ancestors(ctx) & draft()""" |
|
249 | Much faster than the revset ancestors(ctx) & draft()""" | |
245 | seen = set([nodemod.nullrev]) |
|
250 | seen = set([nodemod.nullrev]) | |
246 | visit = collections.deque() |
|
251 | visit = collections.deque() | |
247 | visit.append(ctx) |
|
252 | visit.append(ctx) | |
248 | while visit: |
|
253 | while visit: | |
249 | ctx = visit.popleft() |
|
254 | ctx = visit.popleft() | |
250 | yield ctx.node() |
|
255 | yield ctx.node() | |
251 | for parent in ctx.parents(): |
|
256 | for parent in ctx.parents(): | |
252 | rev = parent.rev() |
|
257 | rev = parent.rev() | |
253 | if rev not in seen: |
|
258 | if rev not in seen: | |
254 | seen.add(rev) |
|
259 | seen.add(rev) | |
255 | if parent.mutable(): |
|
260 | if parent.mutable(): | |
256 | visit.append(parent) |
|
261 | visit.append(parent) | |
257 |
|
262 | |||
258 | wctx = repo[None] |
|
263 | wctx = repo[None] | |
259 | parents = wctx.parents() |
|
264 | parents = wctx.parents() | |
260 | if len(parents) > 1: |
|
265 | if len(parents) > 1: | |
261 | raise error.Abort(_('cannot shelve while merging')) |
|
266 | raise error.Abort(_('cannot shelve while merging')) | |
262 | parent = parents[0] |
|
267 | parent = parents[0] | |
263 | origbranch = wctx.branch() |
|
268 | origbranch = wctx.branch() | |
264 |
|
269 | |||
265 | # we never need the user, so we use a generic user for all shelve operations |
|
270 | # we never need the user, so we use a generic user for all shelve operations | |
266 | user = 'shelve@localhost' |
|
271 | user = 'shelve@localhost' | |
267 | label = repo._activebookmark or parent.branch() or 'default' |
|
272 | label = repo._activebookmark or parent.branch() or 'default' | |
268 |
|
273 | |||
269 | # slashes aren't allowed in filenames, therefore we rename it |
|
274 | # slashes aren't allowed in filenames, therefore we rename it | |
270 | label = label.replace('/', '_') |
|
275 | label = label.replace('/', '_') | |
271 |
|
276 | |||
272 | def gennames(): |
|
277 | def gennames(): | |
273 | yield label |
|
278 | yield label | |
274 | for i in xrange(1, 100): |
|
279 | for i in xrange(1, 100): | |
275 | yield '%s-%02d' % (label, i) |
|
280 | yield '%s-%02d' % (label, i) | |
276 |
|
281 | |||
277 | if parent.node() != nodemod.nullid: |
|
282 | if parent.node() != nodemod.nullid: | |
278 | desc = "changes to: %s" % parent.description().split('\n', 1)[0] |
|
283 | desc = "changes to: %s" % parent.description().split('\n', 1)[0] | |
279 | else: |
|
284 | else: | |
280 | desc = '(changes in empty repository)' |
|
285 | desc = '(changes in empty repository)' | |
281 |
|
286 | |||
282 | if not opts.get('message'): |
|
287 | if not opts.get('message'): | |
283 | opts['message'] = desc |
|
288 | opts['message'] = desc | |
284 |
|
289 | |||
285 | name = opts.get('name') |
|
290 | name = opts.get('name') | |
286 |
|
291 | |||
287 | lock = tr = None |
|
292 | lock = tr = None | |
288 | try: |
|
293 | try: | |
289 | lock = repo.lock() |
|
294 | lock = repo.lock() | |
290 |
|
295 | |||
291 | # use an uncommitted transaction to generate the bundle to avoid |
|
296 | # use an uncommitted transaction to generate the bundle to avoid | |
292 | # pull races. ensure we don't print the abort message to stderr. |
|
297 | # pull races. ensure we don't print the abort message to stderr. | |
293 | tr = repo.transaction('commit', report=lambda x: None) |
|
298 | tr = repo.transaction('commit', report=lambda x: None) | |
294 |
|
299 | |||
295 | if name: |
|
300 | if name: | |
296 | if shelvedfile(repo, name, 'hg').exists(): |
|
301 | if shelvedfile(repo, name, 'hg').exists(): | |
297 | raise error.Abort(_("a shelved change named '%s' already exists" |
|
302 | raise error.Abort(_("a shelved change named '%s' already exists" | |
298 | ) % name) |
|
303 | ) % name) | |
299 | else: |
|
304 | else: | |
300 | for n in gennames(): |
|
305 | for n in gennames(): | |
301 | if not shelvedfile(repo, n, 'hg').exists(): |
|
306 | if not shelvedfile(repo, n, 'hg').exists(): | |
302 | name = n |
|
307 | name = n | |
303 | break |
|
308 | break | |
304 | else: |
|
309 | else: | |
305 | raise error.Abort(_("too many shelved changes named '%s'") % |
|
310 | raise error.Abort(_("too many shelved changes named '%s'") % | |
306 | label) |
|
311 | label) | |
307 |
|
312 | |||
308 | # ensure we are not creating a subdirectory or a hidden file |
|
313 | # ensure we are not creating a subdirectory or a hidden file | |
309 | if '/' in name or '\\' in name: |
|
314 | if '/' in name or '\\' in name: | |
310 | raise error.Abort(_('shelved change names may not contain slashes')) |
|
315 | raise error.Abort(_('shelved change names may not contain slashes')) | |
311 | if name.startswith('.'): |
|
316 | if name.startswith('.'): | |
312 | raise error.Abort(_("shelved change names may not start with '.'")) |
|
317 | raise error.Abort(_("shelved change names may not start with '.'")) | |
313 | interactive = opts.get('interactive', False) |
|
318 | interactive = opts.get('interactive', False) | |
314 | includeunknown = (opts.get('unknown', False) and |
|
319 | includeunknown = (opts.get('unknown', False) and | |
315 | not opts.get('addremove', False)) |
|
320 | not opts.get('addremove', False)) | |
316 |
|
321 | |||
317 | extra={} |
|
322 | extra={} | |
318 | if includeunknown: |
|
323 | if includeunknown: | |
319 | s = repo.status(match=scmutil.match(repo[None], pats, opts), |
|
324 | s = repo.status(match=scmutil.match(repo[None], pats, opts), | |
320 | unknown=True) |
|
325 | unknown=True) | |
321 | if s.unknown: |
|
326 | if s.unknown: | |
322 | extra['shelve_unknown'] = '\0'.join(s.unknown) |
|
327 | extra['shelve_unknown'] = '\0'.join(s.unknown) | |
323 | repo[None].add(s.unknown) |
|
328 | repo[None].add(s.unknown) | |
324 |
|
329 | |||
325 | if _iswctxonnewbranch(repo) and not _isbareshelve(pats, opts): |
|
330 | if _iswctxonnewbranch(repo) and not _isbareshelve(pats, opts): | |
326 | # In non-bare shelve we don't store newly created branch |
|
331 | # In non-bare shelve we don't store newly created branch | |
327 | # at bundled commit |
|
332 | # at bundled commit | |
328 | repo.dirstate.setbranch(repo['.'].branch()) |
|
333 | repo.dirstate.setbranch(repo['.'].branch()) | |
329 |
|
334 | |||
330 | def commitfunc(ui, repo, message, match, opts): |
|
335 | def commitfunc(ui, repo, message, match, opts): | |
331 | hasmq = util.safehasattr(repo, 'mq') |
|
336 | hasmq = util.safehasattr(repo, 'mq') | |
332 | if hasmq: |
|
337 | if hasmq: | |
333 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False |
|
338 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False | |
334 | backup = repo.ui.backupconfig('phases', 'new-commit') |
|
339 | backup = repo.ui.backupconfig('phases', 'new-commit') | |
335 | try: |
|
340 | try: | |
336 | repo.ui. setconfig('phases', 'new-commit', phases.secret) |
|
341 | repo.ui. setconfig('phases', 'new-commit', phases.secret) | |
337 | editor = cmdutil.getcommiteditor(editform='shelve.shelve', |
|
342 | editor = cmdutil.getcommiteditor(editform='shelve.shelve', | |
338 | **opts) |
|
343 | **opts) | |
339 | return repo.commit(message, user, opts.get('date'), match, |
|
344 | return repo.commit(message, user, opts.get('date'), match, | |
340 | editor=editor, extra=extra) |
|
345 | editor=editor, extra=extra) | |
341 | finally: |
|
346 | finally: | |
342 | repo.ui.restoreconfig(backup) |
|
347 | repo.ui.restoreconfig(backup) | |
343 | if hasmq: |
|
348 | if hasmq: | |
344 | repo.mq.checkapplied = saved |
|
349 | repo.mq.checkapplied = saved | |
345 |
|
350 | |||
346 | def interactivecommitfunc(ui, repo, *pats, **opts): |
|
351 | def interactivecommitfunc(ui, repo, *pats, **opts): | |
347 | match = scmutil.match(repo['.'], pats, {}) |
|
352 | match = scmutil.match(repo['.'], pats, {}) | |
348 | message = opts['message'] |
|
353 | message = opts['message'] | |
349 | return commitfunc(ui, repo, message, match, opts) |
|
354 | return commitfunc(ui, repo, message, match, opts) | |
350 | if not interactive: |
|
355 | if not interactive: | |
351 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
|
356 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | |
352 | else: |
|
357 | else: | |
353 | node = cmdutil.dorecord(ui, repo, interactivecommitfunc, None, |
|
358 | node = cmdutil.dorecord(ui, repo, interactivecommitfunc, None, | |
354 | False, cmdutil.recordfilter, *pats, **opts) |
|
359 | False, cmdutil.recordfilter, *pats, **opts) | |
355 | if not node: |
|
360 | if not node: | |
356 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) |
|
361 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | |
357 | if stat.deleted: |
|
362 | if stat.deleted: | |
358 | ui.status(_("nothing changed (%d missing files, see " |
|
363 | ui.status(_("nothing changed (%d missing files, see " | |
359 | "'hg status')\n") % len(stat.deleted)) |
|
364 | "'hg status')\n") % len(stat.deleted)) | |
360 | else: |
|
365 | else: | |
361 | ui.status(_("nothing changed\n")) |
|
366 | ui.status(_("nothing changed\n")) | |
362 | return 1 |
|
367 | return 1 | |
363 |
|
368 | |||
364 | bases = list(mutableancestors(repo[node])) |
|
369 | bases = list(mutableancestors(repo[node])) | |
365 | shelvedfile(repo, name, 'hg').writebundle(bases, node) |
|
370 | shelvedfile(repo, name, 'hg').writebundle(bases, node) | |
366 | cmdutil.export(repo, [node], |
|
371 | cmdutil.export(repo, [node], | |
367 | fp=shelvedfile(repo, name, 'patch').opener('wb'), |
|
372 | fp=shelvedfile(repo, name, 'patch').opener('wb'), | |
368 | opts=mdiff.diffopts(git=True)) |
|
373 | opts=mdiff.diffopts(git=True)) | |
369 |
|
374 | |||
370 |
|
375 | |||
371 | if ui.formatted(): |
|
376 | if ui.formatted(): | |
372 | desc = util.ellipsis(desc, ui.termwidth()) |
|
377 | desc = util.ellipsis(desc, ui.termwidth()) | |
373 | ui.status(_('shelved as %s\n') % name) |
|
378 | ui.status(_('shelved as %s\n') % name) | |
374 | hg.update(repo, parent.node()) |
|
379 | hg.update(repo, parent.node()) | |
375 | if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): |
|
380 | if origbranch != repo['.'].branch() and not _isbareshelve(pats, opts): | |
376 | repo.dirstate.setbranch(origbranch) |
|
381 | repo.dirstate.setbranch(origbranch) | |
377 |
|
382 | |||
378 | _aborttransaction(repo) |
|
383 | _aborttransaction(repo) | |
379 | finally: |
|
384 | finally: | |
380 | lockmod.release(tr, lock) |
|
385 | lockmod.release(tr, lock) | |
381 |
|
386 | |||
382 | def _isbareshelve(pats, opts): |
|
387 | def _isbareshelve(pats, opts): | |
383 | return (not pats |
|
388 | return (not pats | |
384 | and not opts.get('interactive', False) |
|
389 | and not opts.get('interactive', False) | |
385 | and not opts.get('include', False) |
|
390 | and not opts.get('include', False) | |
386 | and not opts.get('exclude', False)) |
|
391 | and not opts.get('exclude', False)) | |
387 |
|
392 | |||
388 | def _iswctxonnewbranch(repo): |
|
393 | def _iswctxonnewbranch(repo): | |
389 | return repo[None].branch() != repo['.'].branch() |
|
394 | return repo[None].branch() != repo['.'].branch() | |
390 |
|
395 | |||
391 | def cleanupcmd(ui, repo): |
|
396 | def cleanupcmd(ui, repo): | |
392 | """subcommand that deletes all shelves""" |
|
397 | """subcommand that deletes all shelves""" | |
393 |
|
398 | |||
394 | with repo.wlock(): |
|
399 | with repo.wlock(): | |
395 | for (name, _type) in repo.vfs.readdir(shelvedir): |
|
400 | for (name, _type) in repo.vfs.readdir(shelvedir): | |
396 | suffix = name.rsplit('.', 1)[-1] |
|
401 | suffix = name.rsplit('.', 1)[-1] | |
397 | if suffix in ('hg', 'patch'): |
|
402 | if suffix in ('hg', 'patch'): | |
398 | shelvedfile(repo, name).movetobackup() |
|
403 | shelvedfile(repo, name).movetobackup() | |
399 | cleanupoldbackups(repo) |
|
404 | cleanupoldbackups(repo) | |
400 |
|
405 | |||
401 | def deletecmd(ui, repo, pats): |
|
406 | def deletecmd(ui, repo, pats): | |
402 | """subcommand that deletes a specific shelve""" |
|
407 | """subcommand that deletes a specific shelve""" | |
403 | if not pats: |
|
408 | if not pats: | |
404 | raise error.Abort(_('no shelved changes specified!')) |
|
409 | raise error.Abort(_('no shelved changes specified!')) | |
405 | with repo.wlock(): |
|
410 | with repo.wlock(): | |
406 | try: |
|
411 | try: | |
407 | for name in pats: |
|
412 | for name in pats: | |
408 | for suffix in 'hg patch'.split(): |
|
413 | for suffix in 'hg patch'.split(): | |
409 | shelvedfile(repo, name, suffix).movetobackup() |
|
414 | shelvedfile(repo, name, suffix).movetobackup() | |
410 | cleanupoldbackups(repo) |
|
415 | cleanupoldbackups(repo) | |
411 | except OSError as err: |
|
416 | except OSError as err: | |
412 | if err.errno != errno.ENOENT: |
|
417 | if err.errno != errno.ENOENT: | |
413 | raise |
|
418 | raise | |
414 | raise error.Abort(_("shelved change '%s' not found") % name) |
|
419 | raise error.Abort(_("shelved change '%s' not found") % name) | |
415 |
|
420 | |||
416 | def listshelves(repo): |
|
421 | def listshelves(repo): | |
417 | """return all shelves in repo as list of (time, filename)""" |
|
422 | """return all shelves in repo as list of (time, filename)""" | |
418 | try: |
|
423 | try: | |
419 | names = repo.vfs.readdir(shelvedir) |
|
424 | names = repo.vfs.readdir(shelvedir) | |
420 | except OSError as err: |
|
425 | except OSError as err: | |
421 | if err.errno != errno.ENOENT: |
|
426 | if err.errno != errno.ENOENT: | |
422 | raise |
|
427 | raise | |
423 | return [] |
|
428 | return [] | |
424 | info = [] |
|
429 | info = [] | |
425 | for (name, _type) in names: |
|
430 | for (name, _type) in names: | |
426 | pfx, sfx = name.rsplit('.', 1) |
|
431 | pfx, sfx = name.rsplit('.', 1) | |
427 | if not pfx or sfx != 'patch': |
|
432 | if not pfx or sfx != 'patch': | |
428 | continue |
|
433 | continue | |
429 | st = shelvedfile(repo, name).stat() |
|
434 | st = shelvedfile(repo, name).stat() | |
430 | info.append((st.st_mtime, shelvedfile(repo, pfx).filename())) |
|
435 | info.append((st.st_mtime, shelvedfile(repo, pfx).filename())) | |
431 | return sorted(info, reverse=True) |
|
436 | return sorted(info, reverse=True) | |
432 |
|
437 | |||
433 | def listcmd(ui, repo, pats, opts): |
|
438 | def listcmd(ui, repo, pats, opts): | |
434 | """subcommand that displays the list of shelves""" |
|
439 | """subcommand that displays the list of shelves""" | |
435 | pats = set(pats) |
|
440 | pats = set(pats) | |
436 | width = 80 |
|
441 | width = 80 | |
437 | if not ui.plain(): |
|
442 | if not ui.plain(): | |
438 | width = ui.termwidth() |
|
443 | width = ui.termwidth() | |
439 | namelabel = 'shelve.newest' |
|
444 | namelabel = 'shelve.newest' | |
440 | for mtime, name in listshelves(repo): |
|
445 | for mtime, name in listshelves(repo): | |
441 | sname = util.split(name)[1] |
|
446 | sname = util.split(name)[1] | |
442 | if pats and sname not in pats: |
|
447 | if pats and sname not in pats: | |
443 | continue |
|
448 | continue | |
444 | ui.write(sname, label=namelabel) |
|
449 | ui.write(sname, label=namelabel) | |
445 | namelabel = 'shelve.name' |
|
450 | namelabel = 'shelve.name' | |
446 | if ui.quiet: |
|
451 | if ui.quiet: | |
447 | ui.write('\n') |
|
452 | ui.write('\n') | |
448 | continue |
|
453 | continue | |
449 | ui.write(' ' * (16 - len(sname))) |
|
454 | ui.write(' ' * (16 - len(sname))) | |
450 | used = 16 |
|
455 | used = 16 | |
451 | age = '(%s)' % templatefilters.age(util.makedate(mtime), abbrev=True) |
|
456 | age = '(%s)' % templatefilters.age(util.makedate(mtime), abbrev=True) | |
452 | ui.write(age, label='shelve.age') |
|
457 | ui.write(age, label='shelve.age') | |
453 | ui.write(' ' * (12 - len(age))) |
|
458 | ui.write(' ' * (12 - len(age))) | |
454 | used += 12 |
|
459 | used += 12 | |
455 | with open(name + '.patch', 'rb') as fp: |
|
460 | with open(name + '.patch', 'rb') as fp: | |
456 | while True: |
|
461 | while True: | |
457 | line = fp.readline() |
|
462 | line = fp.readline() | |
458 | if not line: |
|
463 | if not line: | |
459 | break |
|
464 | break | |
460 | if not line.startswith('#'): |
|
465 | if not line.startswith('#'): | |
461 | desc = line.rstrip() |
|
466 | desc = line.rstrip() | |
462 | if ui.formatted(): |
|
467 | if ui.formatted(): | |
463 | desc = util.ellipsis(desc, width - used) |
|
468 | desc = util.ellipsis(desc, width - used) | |
464 | ui.write(desc) |
|
469 | ui.write(desc) | |
465 | break |
|
470 | break | |
466 | ui.write('\n') |
|
471 | ui.write('\n') | |
467 | if not (opts['patch'] or opts['stat']): |
|
472 | if not (opts['patch'] or opts['stat']): | |
468 | continue |
|
473 | continue | |
469 | difflines = fp.readlines() |
|
474 | difflines = fp.readlines() | |
470 | if opts['patch']: |
|
475 | if opts['patch']: | |
471 | for chunk, label in patch.difflabel(iter, difflines): |
|
476 | for chunk, label in patch.difflabel(iter, difflines): | |
472 | ui.write(chunk, label=label) |
|
477 | ui.write(chunk, label=label) | |
473 | if opts['stat']: |
|
478 | if opts['stat']: | |
474 | for chunk, label in patch.diffstatui(difflines, width=width, |
|
479 | for chunk, label in patch.diffstatui(difflines, width=width, | |
475 | git=True): |
|
480 | git=True): | |
476 | ui.write(chunk, label=label) |
|
481 | ui.write(chunk, label=label) | |
477 |
|
482 | |||
478 | def singlepatchcmds(ui, repo, pats, opts, subcommand): |
|
483 | def singlepatchcmds(ui, repo, pats, opts, subcommand): | |
479 | """subcommand that displays a single shelf""" |
|
484 | """subcommand that displays a single shelf""" | |
480 | if len(pats) != 1: |
|
485 | if len(pats) != 1: | |
481 | raise error.Abort(_("--%s expects a single shelf") % subcommand) |
|
486 | raise error.Abort(_("--%s expects a single shelf") % subcommand) | |
482 | shelfname = pats[0] |
|
487 | shelfname = pats[0] | |
483 |
|
488 | |||
484 | if not shelvedfile(repo, shelfname, 'patch').exists(): |
|
489 | if not shelvedfile(repo, shelfname, 'patch').exists(): | |
485 | raise error.Abort(_("cannot find shelf %s") % shelfname) |
|
490 | raise error.Abort(_("cannot find shelf %s") % shelfname) | |
486 |
|
491 | |||
487 | listcmd(ui, repo, pats, opts) |
|
492 | listcmd(ui, repo, pats, opts) | |
488 |
|
493 | |||
489 | def checkparents(repo, state): |
|
494 | def checkparents(repo, state): | |
490 | """check parent while resuming an unshelve""" |
|
495 | """check parent while resuming an unshelve""" | |
491 | if state.parents != repo.dirstate.parents(): |
|
496 | if state.parents != repo.dirstate.parents(): | |
492 | raise error.Abort(_('working directory parents do not match unshelve ' |
|
497 | raise error.Abort(_('working directory parents do not match unshelve ' | |
493 | 'state')) |
|
498 | 'state')) | |
494 |
|
499 | |||
495 | def pathtofiles(repo, files): |
|
500 | def pathtofiles(repo, files): | |
496 | cwd = repo.getcwd() |
|
501 | cwd = repo.getcwd() | |
497 | return [repo.pathto(f, cwd) for f in files] |
|
502 | return [repo.pathto(f, cwd) for f in files] | |
498 |
|
503 | |||
499 | def unshelveabort(ui, repo, state, opts): |
|
504 | def unshelveabort(ui, repo, state, opts): | |
500 | """subcommand that abort an in-progress unshelve""" |
|
505 | """subcommand that abort an in-progress unshelve""" | |
501 | with repo.lock(): |
|
506 | with repo.lock(): | |
502 | try: |
|
507 | try: | |
503 | checkparents(repo, state) |
|
508 | checkparents(repo, state) | |
504 |
|
509 | |||
505 | util.rename(repo.join('unshelverebasestate'), |
|
510 | util.rename(repo.join('unshelverebasestate'), | |
506 | repo.join('rebasestate')) |
|
511 | repo.join('rebasestate')) | |
507 | try: |
|
512 | try: | |
508 | rebase.rebase(ui, repo, **{ |
|
513 | rebase.rebase(ui, repo, **{ | |
509 | 'abort' : True |
|
514 | 'abort' : True | |
510 | }) |
|
515 | }) | |
511 | except Exception: |
|
516 | except Exception: | |
512 | util.rename(repo.join('rebasestate'), |
|
517 | util.rename(repo.join('rebasestate'), | |
513 | repo.join('unshelverebasestate')) |
|
518 | repo.join('unshelverebasestate')) | |
514 | raise |
|
519 | raise | |
515 |
|
520 | |||
516 | mergefiles(ui, repo, state.wctx, state.pendingctx) |
|
521 | mergefiles(ui, repo, state.wctx, state.pendingctx) | |
517 | repair.strip(ui, repo, state.stripnodes, backup=False, |
|
522 | repair.strip(ui, repo, state.stripnodes, backup=False, | |
518 | topic='shelve') |
|
523 | topic='shelve') | |
519 | finally: |
|
524 | finally: | |
520 | shelvedstate.clear(repo) |
|
525 | shelvedstate.clear(repo) | |
521 | ui.warn(_("unshelve of '%s' aborted\n") % state.name) |
|
526 | ui.warn(_("unshelve of '%s' aborted\n") % state.name) | |
522 |
|
527 | |||
523 | def mergefiles(ui, repo, wctx, shelvectx): |
|
528 | def mergefiles(ui, repo, wctx, shelvectx): | |
524 | """updates to wctx and merges the changes from shelvectx into the |
|
529 | """updates to wctx and merges the changes from shelvectx into the | |
525 | dirstate.""" |
|
530 | dirstate.""" | |
526 | oldquiet = ui.quiet |
|
531 | oldquiet = ui.quiet | |
527 | try: |
|
532 | try: | |
528 | ui.quiet = True |
|
533 | ui.quiet = True | |
529 | hg.update(repo, wctx.node()) |
|
534 | hg.update(repo, wctx.node()) | |
530 | files = [] |
|
535 | files = [] | |
531 | files.extend(shelvectx.files()) |
|
536 | files.extend(shelvectx.files()) | |
532 | files.extend(shelvectx.parents()[0].files()) |
|
537 | files.extend(shelvectx.parents()[0].files()) | |
533 |
|
538 | |||
534 | # revert will overwrite unknown files, so move them out of the way |
|
539 | # revert will overwrite unknown files, so move them out of the way | |
535 | for file in repo.status(unknown=True).unknown: |
|
540 | for file in repo.status(unknown=True).unknown: | |
536 | if file in files: |
|
541 | if file in files: | |
537 | util.rename(file, scmutil.origpath(ui, repo, file)) |
|
542 | util.rename(file, scmutil.origpath(ui, repo, file)) | |
538 | ui.pushbuffer(True) |
|
543 | ui.pushbuffer(True) | |
539 | cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), |
|
544 | cmdutil.revert(ui, repo, shelvectx, repo.dirstate.parents(), | |
540 | *pathtofiles(repo, files), |
|
545 | *pathtofiles(repo, files), | |
541 | **{'no_backup': True}) |
|
546 | **{'no_backup': True}) | |
542 | ui.popbuffer() |
|
547 | ui.popbuffer() | |
543 | finally: |
|
548 | finally: | |
544 | ui.quiet = oldquiet |
|
549 | ui.quiet = oldquiet | |
545 |
|
550 | |||
546 | def restorebranch(ui, repo, branchtorestore): |
|
551 | def restorebranch(ui, repo, branchtorestore): | |
547 | if branchtorestore and branchtorestore != repo.dirstate.branch(): |
|
552 | if branchtorestore and branchtorestore != repo.dirstate.branch(): | |
548 | repo.dirstate.setbranch(branchtorestore) |
|
553 | repo.dirstate.setbranch(branchtorestore) | |
549 | ui.status(_('marked working directory as branch %s\n') |
|
554 | ui.status(_('marked working directory as branch %s\n') | |
550 | % branchtorestore) |
|
555 | % branchtorestore) | |
551 |
|
556 | |||
552 | def unshelvecleanup(ui, repo, name, opts): |
|
557 | def unshelvecleanup(ui, repo, name, opts): | |
553 | """remove related files after an unshelve""" |
|
558 | """remove related files after an unshelve""" | |
554 | if not opts.get('keep'): |
|
559 | if not opts.get('keep'): | |
555 | for filetype in 'hg patch'.split(): |
|
560 | for filetype in 'hg patch'.split(): | |
556 | shelvedfile(repo, name, filetype).movetobackup() |
|
561 | shelvedfile(repo, name, filetype).movetobackup() | |
557 | cleanupoldbackups(repo) |
|
562 | cleanupoldbackups(repo) | |
558 |
|
563 | |||
559 | def unshelvecontinue(ui, repo, state, opts): |
|
564 | def unshelvecontinue(ui, repo, state, opts): | |
560 | """subcommand to continue an in-progress unshelve""" |
|
565 | """subcommand to continue an in-progress unshelve""" | |
561 | # We're finishing off a merge. First parent is our original |
|
566 | # We're finishing off a merge. First parent is our original | |
562 | # parent, second is the temporary "fake" commit we're unshelving. |
|
567 | # parent, second is the temporary "fake" commit we're unshelving. | |
563 | with repo.lock(): |
|
568 | with repo.lock(): | |
564 | checkparents(repo, state) |
|
569 | checkparents(repo, state) | |
565 | ms = merge.mergestate.read(repo) |
|
570 | ms = merge.mergestate.read(repo) | |
566 | if [f for f in ms if ms[f] == 'u']: |
|
571 | if [f for f in ms if ms[f] == 'u']: | |
567 | raise error.Abort( |
|
572 | raise error.Abort( | |
568 | _("unresolved conflicts, can't continue"), |
|
573 | _("unresolved conflicts, can't continue"), | |
569 | hint=_("see 'hg resolve', then 'hg unshelve --continue'")) |
|
574 | hint=_("see 'hg resolve', then 'hg unshelve --continue'")) | |
570 |
|
575 | |||
571 | util.rename(repo.join('unshelverebasestate'), |
|
576 | util.rename(repo.join('unshelverebasestate'), | |
572 | repo.join('rebasestate')) |
|
577 | repo.join('rebasestate')) | |
573 | try: |
|
578 | try: | |
574 | rebase.rebase(ui, repo, **{ |
|
579 | rebase.rebase(ui, repo, **{ | |
575 | 'continue' : True |
|
580 | 'continue' : True | |
576 | }) |
|
581 | }) | |
577 | except Exception: |
|
582 | except Exception: | |
578 | util.rename(repo.join('rebasestate'), |
|
583 | util.rename(repo.join('rebasestate'), | |
579 | repo.join('unshelverebasestate')) |
|
584 | repo.join('unshelverebasestate')) | |
580 | raise |
|
585 | raise | |
581 |
|
586 | |||
582 | shelvectx = repo['tip'] |
|
587 | shelvectx = repo['tip'] | |
583 | if not shelvectx in state.pendingctx.children(): |
|
588 | if not shelvectx in state.pendingctx.children(): | |
584 | # rebase was a no-op, so it produced no child commit |
|
589 | # rebase was a no-op, so it produced no child commit | |
585 | shelvectx = state.pendingctx |
|
590 | shelvectx = state.pendingctx | |
586 | else: |
|
591 | else: | |
587 | # only strip the shelvectx if the rebase produced it |
|
592 | # only strip the shelvectx if the rebase produced it | |
588 | state.stripnodes.append(shelvectx.node()) |
|
593 | state.stripnodes.append(shelvectx.node()) | |
589 |
|
594 | |||
590 | mergefiles(ui, repo, state.wctx, shelvectx) |
|
595 | mergefiles(ui, repo, state.wctx, shelvectx) | |
591 | restorebranch(ui, repo, state.branchtorestore) |
|
596 | restorebranch(ui, repo, state.branchtorestore) | |
592 |
|
597 | |||
593 | repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') |
|
598 | repair.strip(ui, repo, state.stripnodes, backup=False, topic='shelve') | |
594 | shelvedstate.clear(repo) |
|
599 | shelvedstate.clear(repo) | |
595 | unshelvecleanup(ui, repo, state.name, opts) |
|
600 | unshelvecleanup(ui, repo, state.name, opts) | |
596 | ui.status(_("unshelve of '%s' complete\n") % state.name) |
|
601 | ui.status(_("unshelve of '%s' complete\n") % state.name) | |
597 |
|
602 | |||
598 | @command('unshelve', |
|
603 | @command('unshelve', | |
599 | [('a', 'abort', None, |
|
604 | [('a', 'abort', None, | |
600 | _('abort an incomplete unshelve operation')), |
|
605 | _('abort an incomplete unshelve operation')), | |
601 | ('c', 'continue', None, |
|
606 | ('c', 'continue', None, | |
602 | _('continue an incomplete unshelve operation')), |
|
607 | _('continue an incomplete unshelve operation')), | |
603 | ('k', 'keep', None, |
|
608 | ('k', 'keep', None, | |
604 | _('keep shelve after unshelving')), |
|
609 | _('keep shelve after unshelving')), | |
605 | ('t', 'tool', '', _('specify merge tool')), |
|
610 | ('t', 'tool', '', _('specify merge tool')), | |
606 | ('', 'date', '', |
|
611 | ('', 'date', '', | |
607 | _('set date for temporary commits (DEPRECATED)'), _('DATE'))], |
|
612 | _('set date for temporary commits (DEPRECATED)'), _('DATE'))], | |
608 | _('hg unshelve [SHELVED]')) |
|
613 | _('hg unshelve [SHELVED]')) | |
609 | def unshelve(ui, repo, *shelved, **opts): |
|
614 | def unshelve(ui, repo, *shelved, **opts): | |
610 | """restore a shelved change to the working directory |
|
615 | """restore a shelved change to the working directory | |
611 |
|
616 | |||
612 | This command accepts an optional name of a shelved change to |
|
617 | This command accepts an optional name of a shelved change to | |
613 | restore. If none is given, the most recent shelved change is used. |
|
618 | restore. If none is given, the most recent shelved change is used. | |
614 |
|
619 | |||
615 | If a shelved change is applied successfully, the bundle that |
|
620 | If a shelved change is applied successfully, the bundle that | |
616 | contains the shelved changes is moved to a backup location |
|
621 | contains the shelved changes is moved to a backup location | |
617 | (.hg/shelve-backup). |
|
622 | (.hg/shelve-backup). | |
618 |
|
623 | |||
619 | Since you can restore a shelved change on top of an arbitrary |
|
624 | Since you can restore a shelved change on top of an arbitrary | |
620 | commit, it is possible that unshelving will result in a conflict |
|
625 | commit, it is possible that unshelving will result in a conflict | |
621 | between your changes and the commits you are unshelving onto. If |
|
626 | between your changes and the commits you are unshelving onto. If | |
622 | this occurs, you must resolve the conflict, then use |
|
627 | this occurs, you must resolve the conflict, then use | |
623 | ``--continue`` to complete the unshelve operation. (The bundle |
|
628 | ``--continue`` to complete the unshelve operation. (The bundle | |
624 | will not be moved until you successfully complete the unshelve.) |
|
629 | will not be moved until you successfully complete the unshelve.) | |
625 |
|
630 | |||
626 | (Alternatively, you can use ``--abort`` to abandon an unshelve |
|
631 | (Alternatively, you can use ``--abort`` to abandon an unshelve | |
627 | that causes a conflict. This reverts the unshelved changes, and |
|
632 | that causes a conflict. This reverts the unshelved changes, and | |
628 | leaves the bundle in place.) |
|
633 | leaves the bundle in place.) | |
629 |
|
634 | |||
630 | If bare shelved change(when no files are specified, without interactive, |
|
635 | If bare shelved change(when no files are specified, without interactive, | |
631 | include and exclude option) was done on newly created branch it would |
|
636 | include and exclude option) was done on newly created branch it would | |
632 | restore branch information to the working directory. |
|
637 | restore branch information to the working directory. | |
633 |
|
638 | |||
634 | After a successful unshelve, the shelved changes are stored in a |
|
639 | After a successful unshelve, the shelved changes are stored in a | |
635 | backup directory. Only the N most recent backups are kept. N |
|
640 | backup directory. Only the N most recent backups are kept. N | |
636 | defaults to 10 but can be overridden using the ``shelve.maxbackups`` |
|
641 | defaults to 10 but can be overridden using the ``shelve.maxbackups`` | |
637 | configuration option. |
|
642 | configuration option. | |
638 |
|
643 | |||
639 | .. container:: verbose |
|
644 | .. container:: verbose | |
640 |
|
645 | |||
641 | Timestamp in seconds is used to decide order of backups. More |
|
646 | Timestamp in seconds is used to decide order of backups. More | |
642 | than ``maxbackups`` backups are kept, if same timestamp |
|
647 | than ``maxbackups`` backups are kept, if same timestamp | |
643 | prevents from deciding exact order of them, for safety. |
|
648 | prevents from deciding exact order of them, for safety. | |
644 | """ |
|
649 | """ | |
645 | with repo.wlock(): |
|
650 | with repo.wlock(): | |
646 | return _dounshelve(ui, repo, *shelved, **opts) |
|
651 | return _dounshelve(ui, repo, *shelved, **opts) | |
647 |
|
652 | |||
648 | def _dounshelve(ui, repo, *shelved, **opts): |
|
653 | def _dounshelve(ui, repo, *shelved, **opts): | |
649 | abortf = opts.get('abort') |
|
654 | abortf = opts.get('abort') | |
650 | continuef = opts.get('continue') |
|
655 | continuef = opts.get('continue') | |
651 | if not abortf and not continuef: |
|
656 | if not abortf and not continuef: | |
652 | cmdutil.checkunfinished(repo) |
|
657 | cmdutil.checkunfinished(repo) | |
653 |
|
658 | |||
654 | if abortf or continuef: |
|
659 | if abortf or continuef: | |
655 | if abortf and continuef: |
|
660 | if abortf and continuef: | |
656 | raise error.Abort(_('cannot use both abort and continue')) |
|
661 | raise error.Abort(_('cannot use both abort and continue')) | |
657 | if shelved: |
|
662 | if shelved: | |
658 | raise error.Abort(_('cannot combine abort/continue with ' |
|
663 | raise error.Abort(_('cannot combine abort/continue with ' | |
659 | 'naming a shelved change')) |
|
664 | 'naming a shelved change')) | |
660 | if abortf and opts.get('tool', False): |
|
665 | if abortf and opts.get('tool', False): | |
661 | ui.warn(_('tool option will be ignored\n')) |
|
666 | ui.warn(_('tool option will be ignored\n')) | |
662 |
|
667 | |||
663 | try: |
|
668 | try: | |
664 | state = shelvedstate.load(repo) |
|
669 | state = shelvedstate.load(repo) | |
665 | except IOError as err: |
|
670 | except IOError as err: | |
666 | if err.errno != errno.ENOENT: |
|
671 | if err.errno != errno.ENOENT: | |
667 | raise |
|
672 | raise | |
668 | cmdutil.wrongtooltocontinue(repo, _('unshelve')) |
|
673 | cmdutil.wrongtooltocontinue(repo, _('unshelve')) | |
|
674 | except error.CorruptedState as err: | |||
|
675 | ui.debug(str(err) + '\n') | |||
|
676 | if continuef: | |||
|
677 | msg = _('corrupted shelved state file') | |||
|
678 | hint = _('please run hg unshelve --abort to abort unshelve ' | |||
|
679 | 'operation') | |||
|
680 | raise error.Abort(msg, hint=hint) | |||
|
681 | elif abortf: | |||
|
682 | msg = _('could not read shelved state file, your working copy ' | |||
|
683 | 'may be in an unexpected state\nplease update to some ' | |||
|
684 | 'commit\n') | |||
|
685 | ui.warn(msg) | |||
|
686 | shelvedstate.clear(repo) | |||
|
687 | return | |||
669 |
|
688 | |||
670 | if abortf: |
|
689 | if abortf: | |
671 | return unshelveabort(ui, repo, state, opts) |
|
690 | return unshelveabort(ui, repo, state, opts) | |
672 | elif continuef: |
|
691 | elif continuef: | |
673 | return unshelvecontinue(ui, repo, state, opts) |
|
692 | return unshelvecontinue(ui, repo, state, opts) | |
674 | elif len(shelved) > 1: |
|
693 | elif len(shelved) > 1: | |
675 | raise error.Abort(_('can only unshelve one change at a time')) |
|
694 | raise error.Abort(_('can only unshelve one change at a time')) | |
676 | elif not shelved: |
|
695 | elif not shelved: | |
677 | shelved = listshelves(repo) |
|
696 | shelved = listshelves(repo) | |
678 | if not shelved: |
|
697 | if not shelved: | |
679 | raise error.Abort(_('no shelved changes to apply!')) |
|
698 | raise error.Abort(_('no shelved changes to apply!')) | |
680 | basename = util.split(shelved[0][1])[1] |
|
699 | basename = util.split(shelved[0][1])[1] | |
681 | ui.status(_("unshelving change '%s'\n") % basename) |
|
700 | ui.status(_("unshelving change '%s'\n") % basename) | |
682 | else: |
|
701 | else: | |
683 | basename = shelved[0] |
|
702 | basename = shelved[0] | |
684 |
|
703 | |||
685 | if not shelvedfile(repo, basename, 'patch').exists(): |
|
704 | if not shelvedfile(repo, basename, 'patch').exists(): | |
686 | raise error.Abort(_("shelved change '%s' not found") % basename) |
|
705 | raise error.Abort(_("shelved change '%s' not found") % basename) | |
687 |
|
706 | |||
688 | oldquiet = ui.quiet |
|
707 | oldquiet = ui.quiet | |
689 | lock = tr = None |
|
708 | lock = tr = None | |
690 | forcemerge = ui.backupconfig('ui', 'forcemerge') |
|
709 | forcemerge = ui.backupconfig('ui', 'forcemerge') | |
691 | try: |
|
710 | try: | |
692 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'unshelve') |
|
711 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'unshelve') | |
693 | lock = repo.lock() |
|
712 | lock = repo.lock() | |
694 |
|
713 | |||
695 | tr = repo.transaction('unshelve', report=lambda x: None) |
|
714 | tr = repo.transaction('unshelve', report=lambda x: None) | |
696 | oldtiprev = len(repo) |
|
715 | oldtiprev = len(repo) | |
697 |
|
716 | |||
698 | pctx = repo['.'] |
|
717 | pctx = repo['.'] | |
699 | tmpwctx = pctx |
|
718 | tmpwctx = pctx | |
700 | # The goal is to have a commit structure like so: |
|
719 | # The goal is to have a commit structure like so: | |
701 | # ...-> pctx -> tmpwctx -> shelvectx |
|
720 | # ...-> pctx -> tmpwctx -> shelvectx | |
702 | # where tmpwctx is an optional commit with the user's pending changes |
|
721 | # where tmpwctx is an optional commit with the user's pending changes | |
703 | # and shelvectx is the unshelved changes. Then we merge it all down |
|
722 | # and shelvectx is the unshelved changes. Then we merge it all down | |
704 | # to the original pctx. |
|
723 | # to the original pctx. | |
705 |
|
724 | |||
706 | # Store pending changes in a commit and remember added in case a shelve |
|
725 | # Store pending changes in a commit and remember added in case a shelve | |
707 | # contains unknown files that are part of the pending change |
|
726 | # contains unknown files that are part of the pending change | |
708 | s = repo.status() |
|
727 | s = repo.status() | |
709 | addedbefore = frozenset(s.added) |
|
728 | addedbefore = frozenset(s.added) | |
710 | if s.modified or s.added or s.removed or s.deleted: |
|
729 | if s.modified or s.added or s.removed or s.deleted: | |
711 | ui.status(_("temporarily committing pending changes " |
|
730 | ui.status(_("temporarily committing pending changes " | |
712 | "(restore with 'hg unshelve --abort')\n")) |
|
731 | "(restore with 'hg unshelve --abort')\n")) | |
713 | def commitfunc(ui, repo, message, match, opts): |
|
732 | def commitfunc(ui, repo, message, match, opts): | |
714 | hasmq = util.safehasattr(repo, 'mq') |
|
733 | hasmq = util.safehasattr(repo, 'mq') | |
715 | if hasmq: |
|
734 | if hasmq: | |
716 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False |
|
735 | saved, repo.mq.checkapplied = repo.mq.checkapplied, False | |
717 |
|
736 | |||
718 | backup = repo.ui.backupconfig('phases', 'new-commit') |
|
737 | backup = repo.ui.backupconfig('phases', 'new-commit') | |
719 | try: |
|
738 | try: | |
720 | repo.ui.setconfig('phases', 'new-commit', phases.secret) |
|
739 | repo.ui.setconfig('phases', 'new-commit', phases.secret) | |
721 | return repo.commit(message, 'shelve@localhost', |
|
740 | return repo.commit(message, 'shelve@localhost', | |
722 | opts.get('date'), match) |
|
741 | opts.get('date'), match) | |
723 | finally: |
|
742 | finally: | |
724 | repo.ui.restoreconfig(backup) |
|
743 | repo.ui.restoreconfig(backup) | |
725 | if hasmq: |
|
744 | if hasmq: | |
726 | repo.mq.checkapplied = saved |
|
745 | repo.mq.checkapplied = saved | |
727 |
|
746 | |||
728 | tempopts = {} |
|
747 | tempopts = {} | |
729 | tempopts['message'] = "pending changes temporary commit" |
|
748 | tempopts['message'] = "pending changes temporary commit" | |
730 | tempopts['date'] = opts.get('date') |
|
749 | tempopts['date'] = opts.get('date') | |
731 | ui.quiet = True |
|
750 | ui.quiet = True | |
732 | node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) |
|
751 | node = cmdutil.commit(ui, repo, commitfunc, [], tempopts) | |
733 | tmpwctx = repo[node] |
|
752 | tmpwctx = repo[node] | |
734 |
|
753 | |||
735 | ui.quiet = True |
|
754 | ui.quiet = True | |
736 | shelvedfile(repo, basename, 'hg').applybundle() |
|
755 | shelvedfile(repo, basename, 'hg').applybundle() | |
737 |
|
756 | |||
738 | ui.quiet = oldquiet |
|
757 | ui.quiet = oldquiet | |
739 |
|
758 | |||
740 | shelvectx = repo['tip'] |
|
759 | shelvectx = repo['tip'] | |
741 |
|
760 | |||
742 | branchtorestore = '' |
|
761 | branchtorestore = '' | |
743 | if shelvectx.branch() != shelvectx.p1().branch(): |
|
762 | if shelvectx.branch() != shelvectx.p1().branch(): | |
744 | branchtorestore = shelvectx.branch() |
|
763 | branchtorestore = shelvectx.branch() | |
745 |
|
764 | |||
746 | # If the shelve is not immediately on top of the commit |
|
765 | # If the shelve is not immediately on top of the commit | |
747 | # we'll be merging with, rebase it to be on top. |
|
766 | # we'll be merging with, rebase it to be on top. | |
748 | if tmpwctx.node() != shelvectx.parents()[0].node(): |
|
767 | if tmpwctx.node() != shelvectx.parents()[0].node(): | |
749 | ui.status(_('rebasing shelved changes\n')) |
|
768 | ui.status(_('rebasing shelved changes\n')) | |
750 | try: |
|
769 | try: | |
751 | rebase.rebase(ui, repo, **{ |
|
770 | rebase.rebase(ui, repo, **{ | |
752 | 'rev' : [shelvectx.rev()], |
|
771 | 'rev' : [shelvectx.rev()], | |
753 | 'dest' : str(tmpwctx.rev()), |
|
772 | 'dest' : str(tmpwctx.rev()), | |
754 | 'keep' : True, |
|
773 | 'keep' : True, | |
755 | 'tool' : opts.get('tool', ''), |
|
774 | 'tool' : opts.get('tool', ''), | |
756 | }) |
|
775 | }) | |
757 | except error.InterventionRequired: |
|
776 | except error.InterventionRequired: | |
758 | tr.close() |
|
777 | tr.close() | |
759 |
|
778 | |||
760 | stripnodes = [repo.changelog.node(rev) |
|
779 | stripnodes = [repo.changelog.node(rev) | |
761 | for rev in xrange(oldtiprev, len(repo))] |
|
780 | for rev in xrange(oldtiprev, len(repo))] | |
762 | shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes, |
|
781 | shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes, | |
763 | branchtorestore) |
|
782 | branchtorestore) | |
764 |
|
783 | |||
765 | util.rename(repo.join('rebasestate'), |
|
784 | util.rename(repo.join('rebasestate'), | |
766 | repo.join('unshelverebasestate')) |
|
785 | repo.join('unshelverebasestate')) | |
767 | raise error.InterventionRequired( |
|
786 | raise error.InterventionRequired( | |
768 | _("unresolved conflicts (see 'hg resolve', then " |
|
787 | _("unresolved conflicts (see 'hg resolve', then " | |
769 | "'hg unshelve --continue')")) |
|
788 | "'hg unshelve --continue')")) | |
770 |
|
789 | |||
771 | # refresh ctx after rebase completes |
|
790 | # refresh ctx after rebase completes | |
772 | shelvectx = repo['tip'] |
|
791 | shelvectx = repo['tip'] | |
773 |
|
792 | |||
774 | if not shelvectx in tmpwctx.children(): |
|
793 | if not shelvectx in tmpwctx.children(): | |
775 | # rebase was a no-op, so it produced no child commit |
|
794 | # rebase was a no-op, so it produced no child commit | |
776 | shelvectx = tmpwctx |
|
795 | shelvectx = tmpwctx | |
777 |
|
796 | |||
778 | mergefiles(ui, repo, pctx, shelvectx) |
|
797 | mergefiles(ui, repo, pctx, shelvectx) | |
779 | restorebranch(ui, repo, branchtorestore) |
|
798 | restorebranch(ui, repo, branchtorestore) | |
780 |
|
799 | |||
781 | # Forget any files that were unknown before the shelve, unknown before |
|
800 | # Forget any files that were unknown before the shelve, unknown before | |
782 | # unshelve started, but are now added. |
|
801 | # unshelve started, but are now added. | |
783 | shelveunknown = shelvectx.extra().get('shelve_unknown') |
|
802 | shelveunknown = shelvectx.extra().get('shelve_unknown') | |
784 | if shelveunknown: |
|
803 | if shelveunknown: | |
785 | shelveunknown = frozenset(shelveunknown.split('\0')) |
|
804 | shelveunknown = frozenset(shelveunknown.split('\0')) | |
786 | addedafter = frozenset(repo.status().added) |
|
805 | addedafter = frozenset(repo.status().added) | |
787 | toforget = (addedafter & shelveunknown) - addedbefore |
|
806 | toforget = (addedafter & shelveunknown) - addedbefore | |
788 | repo[None].forget(toforget) |
|
807 | repo[None].forget(toforget) | |
789 |
|
808 | |||
790 | shelvedstate.clear(repo) |
|
809 | shelvedstate.clear(repo) | |
791 |
|
810 | |||
792 | # The transaction aborting will strip all the commits for us, |
|
811 | # The transaction aborting will strip all the commits for us, | |
793 | # but it doesn't update the inmemory structures, so addchangegroup |
|
812 | # but it doesn't update the inmemory structures, so addchangegroup | |
794 | # hooks still fire and try to operate on the missing commits. |
|
813 | # hooks still fire and try to operate on the missing commits. | |
795 | # Clean up manually to prevent this. |
|
814 | # Clean up manually to prevent this. | |
796 | repo.unfiltered().changelog.strip(oldtiprev, tr) |
|
815 | repo.unfiltered().changelog.strip(oldtiprev, tr) | |
797 |
|
816 | |||
798 | unshelvecleanup(ui, repo, basename, opts) |
|
817 | unshelvecleanup(ui, repo, basename, opts) | |
799 |
|
818 | |||
800 | _aborttransaction(repo) |
|
819 | _aborttransaction(repo) | |
801 | finally: |
|
820 | finally: | |
802 | ui.quiet = oldquiet |
|
821 | ui.quiet = oldquiet | |
803 | if tr: |
|
822 | if tr: | |
804 | tr.release() |
|
823 | tr.release() | |
805 | lockmod.release(lock) |
|
824 | lockmod.release(lock) | |
806 | ui.restoreconfig(forcemerge) |
|
825 | ui.restoreconfig(forcemerge) | |
807 |
|
826 | |||
808 | @command('shelve', |
|
827 | @command('shelve', | |
809 | [('A', 'addremove', None, |
|
828 | [('A', 'addremove', None, | |
810 | _('mark new/missing files as added/removed before shelving')), |
|
829 | _('mark new/missing files as added/removed before shelving')), | |
811 | ('u', 'unknown', None, |
|
830 | ('u', 'unknown', None, | |
812 | _('store unknown files in the shelve')), |
|
831 | _('store unknown files in the shelve')), | |
813 | ('', 'cleanup', None, |
|
832 | ('', 'cleanup', None, | |
814 | _('delete all shelved changes')), |
|
833 | _('delete all shelved changes')), | |
815 | ('', 'date', '', |
|
834 | ('', 'date', '', | |
816 | _('shelve with the specified commit date'), _('DATE')), |
|
835 | _('shelve with the specified commit date'), _('DATE')), | |
817 | ('d', 'delete', None, |
|
836 | ('d', 'delete', None, | |
818 | _('delete the named shelved change(s)')), |
|
837 | _('delete the named shelved change(s)')), | |
819 | ('e', 'edit', False, |
|
838 | ('e', 'edit', False, | |
820 | _('invoke editor on commit messages')), |
|
839 | _('invoke editor on commit messages')), | |
821 | ('l', 'list', None, |
|
840 | ('l', 'list', None, | |
822 | _('list current shelves')), |
|
841 | _('list current shelves')), | |
823 | ('m', 'message', '', |
|
842 | ('m', 'message', '', | |
824 | _('use text as shelve message'), _('TEXT')), |
|
843 | _('use text as shelve message'), _('TEXT')), | |
825 | ('n', 'name', '', |
|
844 | ('n', 'name', '', | |
826 | _('use the given name for the shelved commit'), _('NAME')), |
|
845 | _('use the given name for the shelved commit'), _('NAME')), | |
827 | ('p', 'patch', None, |
|
846 | ('p', 'patch', None, | |
828 | _('show patch')), |
|
847 | _('show patch')), | |
829 | ('i', 'interactive', None, |
|
848 | ('i', 'interactive', None, | |
830 | _('interactive mode, only works while creating a shelve')), |
|
849 | _('interactive mode, only works while creating a shelve')), | |
831 | ('', 'stat', None, |
|
850 | ('', 'stat', None, | |
832 | _('output diffstat-style summary of changes'))] + commands.walkopts, |
|
851 | _('output diffstat-style summary of changes'))] + commands.walkopts, | |
833 | _('hg shelve [OPTION]... [FILE]...')) |
|
852 | _('hg shelve [OPTION]... [FILE]...')) | |
834 | def shelvecmd(ui, repo, *pats, **opts): |
|
853 | def shelvecmd(ui, repo, *pats, **opts): | |
835 | '''save and set aside changes from the working directory |
|
854 | '''save and set aside changes from the working directory | |
836 |
|
855 | |||
837 | Shelving takes files that "hg status" reports as not clean, saves |
|
856 | Shelving takes files that "hg status" reports as not clean, saves | |
838 | the modifications to a bundle (a shelved change), and reverts the |
|
857 | the modifications to a bundle (a shelved change), and reverts the | |
839 | files so that their state in the working directory becomes clean. |
|
858 | files so that their state in the working directory becomes clean. | |
840 |
|
859 | |||
841 | To restore these changes to the working directory, using "hg |
|
860 | To restore these changes to the working directory, using "hg | |
842 | unshelve"; this will work even if you switch to a different |
|
861 | unshelve"; this will work even if you switch to a different | |
843 | commit. |
|
862 | commit. | |
844 |
|
863 | |||
845 | When no files are specified, "hg shelve" saves all not-clean |
|
864 | When no files are specified, "hg shelve" saves all not-clean | |
846 | files. If specific files or directories are named, only changes to |
|
865 | files. If specific files or directories are named, only changes to | |
847 | those files are shelved. |
|
866 | those files are shelved. | |
848 |
|
867 | |||
849 | In bare shelve(when no files are specified, without interactive, |
|
868 | In bare shelve(when no files are specified, without interactive, | |
850 | include and exclude option), shelving remembers information if the |
|
869 | include and exclude option), shelving remembers information if the | |
851 | working directory was on newly created branch, in other words working |
|
870 | working directory was on newly created branch, in other words working | |
852 | directory was on different branch than its first parent. In this |
|
871 | directory was on different branch than its first parent. In this | |
853 | situation unshelving restores branch information to the working directory. |
|
872 | situation unshelving restores branch information to the working directory. | |
854 |
|
873 | |||
855 | Each shelved change has a name that makes it easier to find later. |
|
874 | Each shelved change has a name that makes it easier to find later. | |
856 | The name of a shelved change defaults to being based on the active |
|
875 | The name of a shelved change defaults to being based on the active | |
857 | bookmark, or if there is no active bookmark, the current named |
|
876 | bookmark, or if there is no active bookmark, the current named | |
858 | branch. To specify a different name, use ``--name``. |
|
877 | branch. To specify a different name, use ``--name``. | |
859 |
|
878 | |||
860 | To see a list of existing shelved changes, use the ``--list`` |
|
879 | To see a list of existing shelved changes, use the ``--list`` | |
861 | option. For each shelved change, this will print its name, age, |
|
880 | option. For each shelved change, this will print its name, age, | |
862 | and description; use ``--patch`` or ``--stat`` for more details. |
|
881 | and description; use ``--patch`` or ``--stat`` for more details. | |
863 |
|
882 | |||
864 | To delete specific shelved changes, use ``--delete``. To delete |
|
883 | To delete specific shelved changes, use ``--delete``. To delete | |
865 | all shelved changes, use ``--cleanup``. |
|
884 | all shelved changes, use ``--cleanup``. | |
866 | ''' |
|
885 | ''' | |
867 | allowables = [ |
|
886 | allowables = [ | |
868 | ('addremove', set(['create'])), # 'create' is pseudo action |
|
887 | ('addremove', set(['create'])), # 'create' is pseudo action | |
869 | ('unknown', set(['create'])), |
|
888 | ('unknown', set(['create'])), | |
870 | ('cleanup', set(['cleanup'])), |
|
889 | ('cleanup', set(['cleanup'])), | |
871 | # ('date', set(['create'])), # ignored for passing '--date "0 0"' in tests |
|
890 | # ('date', set(['create'])), # ignored for passing '--date "0 0"' in tests | |
872 | ('delete', set(['delete'])), |
|
891 | ('delete', set(['delete'])), | |
873 | ('edit', set(['create'])), |
|
892 | ('edit', set(['create'])), | |
874 | ('list', set(['list'])), |
|
893 | ('list', set(['list'])), | |
875 | ('message', set(['create'])), |
|
894 | ('message', set(['create'])), | |
876 | ('name', set(['create'])), |
|
895 | ('name', set(['create'])), | |
877 | ('patch', set(['patch', 'list'])), |
|
896 | ('patch', set(['patch', 'list'])), | |
878 | ('stat', set(['stat', 'list'])), |
|
897 | ('stat', set(['stat', 'list'])), | |
879 | ] |
|
898 | ] | |
880 | def checkopt(opt): |
|
899 | def checkopt(opt): | |
881 | if opts.get(opt): |
|
900 | if opts.get(opt): | |
882 | for i, allowable in allowables: |
|
901 | for i, allowable in allowables: | |
883 | if opts[i] and opt not in allowable: |
|
902 | if opts[i] and opt not in allowable: | |
884 | raise error.Abort(_("options '--%s' and '--%s' may not be " |
|
903 | raise error.Abort(_("options '--%s' and '--%s' may not be " | |
885 | "used together") % (opt, i)) |
|
904 | "used together") % (opt, i)) | |
886 | return True |
|
905 | return True | |
887 | if checkopt('cleanup'): |
|
906 | if checkopt('cleanup'): | |
888 | if pats: |
|
907 | if pats: | |
889 | raise error.Abort(_("cannot specify names when using '--cleanup'")) |
|
908 | raise error.Abort(_("cannot specify names when using '--cleanup'")) | |
890 | return cleanupcmd(ui, repo) |
|
909 | return cleanupcmd(ui, repo) | |
891 | elif checkopt('delete'): |
|
910 | elif checkopt('delete'): | |
892 | return deletecmd(ui, repo, pats) |
|
911 | return deletecmd(ui, repo, pats) | |
893 | elif checkopt('list'): |
|
912 | elif checkopt('list'): | |
894 | return listcmd(ui, repo, pats, opts) |
|
913 | return listcmd(ui, repo, pats, opts) | |
895 | elif checkopt('patch'): |
|
914 | elif checkopt('patch'): | |
896 | return singlepatchcmds(ui, repo, pats, opts, subcommand='patch') |
|
915 | return singlepatchcmds(ui, repo, pats, opts, subcommand='patch') | |
897 | elif checkopt('stat'): |
|
916 | elif checkopt('stat'): | |
898 | return singlepatchcmds(ui, repo, pats, opts, subcommand='stat') |
|
917 | return singlepatchcmds(ui, repo, pats, opts, subcommand='stat') | |
899 | else: |
|
918 | else: | |
900 | return createcmd(ui, repo, pats, opts) |
|
919 | return createcmd(ui, repo, pats, opts) | |
901 |
|
920 | |||
902 | def extsetup(ui): |
|
921 | def extsetup(ui): | |
903 | cmdutil.unfinishedstates.append( |
|
922 | cmdutil.unfinishedstates.append( | |
904 | [shelvedstate._filename, False, False, |
|
923 | [shelvedstate._filename, False, False, | |
905 | _('unshelve already in progress'), |
|
924 | _('unshelve already in progress'), | |
906 | _("use 'hg unshelve --continue' or 'hg unshelve --abort'")]) |
|
925 | _("use 'hg unshelve --continue' or 'hg unshelve --abort'")]) | |
907 | cmdutil.afterresolvedstates.append( |
|
926 | cmdutil.afterresolvedstates.append( | |
908 | [shelvedstate._filename, _('hg unshelve --continue')]) |
|
927 | [shelvedstate._filename, _('hg unshelve --continue')]) |
@@ -1,242 +1,245 | |||||
1 | # error.py - Mercurial exceptions |
|
1 | # error.py - Mercurial exceptions | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2008 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2008 Matt Mackall <mpm@selenic.com> | |
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 | """Mercurial exceptions. |
|
8 | """Mercurial exceptions. | |
9 |
|
9 | |||
10 | This allows us to catch exceptions at higher levels without forcing |
|
10 | This allows us to catch exceptions at higher levels without forcing | |
11 | imports. |
|
11 | imports. | |
12 | """ |
|
12 | """ | |
13 |
|
13 | |||
14 | from __future__ import absolute_import |
|
14 | from __future__ import absolute_import | |
15 |
|
15 | |||
16 | # Do not import anything here, please |
|
16 | # Do not import anything here, please | |
17 |
|
17 | |||
18 | class Hint(object): |
|
18 | class Hint(object): | |
19 | """Mix-in to provide a hint of an error |
|
19 | """Mix-in to provide a hint of an error | |
20 |
|
20 | |||
21 | This should come first in the inheritance list to consume a hint and |
|
21 | This should come first in the inheritance list to consume a hint and | |
22 | pass remaining arguments to the exception class. |
|
22 | pass remaining arguments to the exception class. | |
23 | """ |
|
23 | """ | |
24 | def __init__(self, *args, **kw): |
|
24 | def __init__(self, *args, **kw): | |
25 | self.hint = kw.pop('hint', None) |
|
25 | self.hint = kw.pop('hint', None) | |
26 | super(Hint, self).__init__(*args, **kw) |
|
26 | super(Hint, self).__init__(*args, **kw) | |
27 |
|
27 | |||
28 | class RevlogError(Hint, Exception): |
|
28 | class RevlogError(Hint, Exception): | |
29 | pass |
|
29 | pass | |
30 |
|
30 | |||
31 | class FilteredIndexError(IndexError): |
|
31 | class FilteredIndexError(IndexError): | |
32 | pass |
|
32 | pass | |
33 |
|
33 | |||
34 | class LookupError(RevlogError, KeyError): |
|
34 | class LookupError(RevlogError, KeyError): | |
35 | def __init__(self, name, index, message): |
|
35 | def __init__(self, name, index, message): | |
36 | self.name = name |
|
36 | self.name = name | |
37 | self.index = index |
|
37 | self.index = index | |
38 | # this can't be called 'message' because at least some installs of |
|
38 | # this can't be called 'message' because at least some installs of | |
39 | # Python 2.6+ complain about the 'message' property being deprecated |
|
39 | # Python 2.6+ complain about the 'message' property being deprecated | |
40 | self.lookupmessage = message |
|
40 | self.lookupmessage = message | |
41 | if isinstance(name, str) and len(name) == 20: |
|
41 | if isinstance(name, str) and len(name) == 20: | |
42 | from .node import short |
|
42 | from .node import short | |
43 | name = short(name) |
|
43 | name = short(name) | |
44 | RevlogError.__init__(self, '%s@%s: %s' % (index, name, message)) |
|
44 | RevlogError.__init__(self, '%s@%s: %s' % (index, name, message)) | |
45 |
|
45 | |||
46 | def __str__(self): |
|
46 | def __str__(self): | |
47 | return RevlogError.__str__(self) |
|
47 | return RevlogError.__str__(self) | |
48 |
|
48 | |||
49 | class FilteredLookupError(LookupError): |
|
49 | class FilteredLookupError(LookupError): | |
50 | pass |
|
50 | pass | |
51 |
|
51 | |||
52 | class ManifestLookupError(LookupError): |
|
52 | class ManifestLookupError(LookupError): | |
53 | pass |
|
53 | pass | |
54 |
|
54 | |||
55 | class CommandError(Exception): |
|
55 | class CommandError(Exception): | |
56 | """Exception raised on errors in parsing the command line.""" |
|
56 | """Exception raised on errors in parsing the command line.""" | |
57 |
|
57 | |||
58 | class InterventionRequired(Hint, Exception): |
|
58 | class InterventionRequired(Hint, Exception): | |
59 | """Exception raised when a command requires human intervention.""" |
|
59 | """Exception raised when a command requires human intervention.""" | |
60 |
|
60 | |||
61 | class Abort(Hint, Exception): |
|
61 | class Abort(Hint, Exception): | |
62 | """Raised if a command needs to print an error and exit.""" |
|
62 | """Raised if a command needs to print an error and exit.""" | |
63 |
|
63 | |||
64 | class HookLoadError(Abort): |
|
64 | class HookLoadError(Abort): | |
65 | """raised when loading a hook fails, aborting an operation |
|
65 | """raised when loading a hook fails, aborting an operation | |
66 |
|
66 | |||
67 | Exists to allow more specialized catching.""" |
|
67 | Exists to allow more specialized catching.""" | |
68 |
|
68 | |||
69 | class HookAbort(Abort): |
|
69 | class HookAbort(Abort): | |
70 | """raised when a validation hook fails, aborting an operation |
|
70 | """raised when a validation hook fails, aborting an operation | |
71 |
|
71 | |||
72 | Exists to allow more specialized catching.""" |
|
72 | Exists to allow more specialized catching.""" | |
73 |
|
73 | |||
74 | class ConfigError(Abort): |
|
74 | class ConfigError(Abort): | |
75 | """Exception raised when parsing config files""" |
|
75 | """Exception raised when parsing config files""" | |
76 |
|
76 | |||
77 | class UpdateAbort(Abort): |
|
77 | class UpdateAbort(Abort): | |
78 | """Raised when an update is aborted for destination issue""" |
|
78 | """Raised when an update is aborted for destination issue""" | |
79 |
|
79 | |||
80 | class MergeDestAbort(Abort): |
|
80 | class MergeDestAbort(Abort): | |
81 | """Raised when an update is aborted for destination issues""" |
|
81 | """Raised when an update is aborted for destination issues""" | |
82 |
|
82 | |||
83 | class NoMergeDestAbort(MergeDestAbort): |
|
83 | class NoMergeDestAbort(MergeDestAbort): | |
84 | """Raised when an update is aborted because there is nothing to merge""" |
|
84 | """Raised when an update is aborted because there is nothing to merge""" | |
85 |
|
85 | |||
86 | class ManyMergeDestAbort(MergeDestAbort): |
|
86 | class ManyMergeDestAbort(MergeDestAbort): | |
87 | """Raised when an update is aborted because destination is ambigious""" |
|
87 | """Raised when an update is aborted because destination is ambigious""" | |
88 |
|
88 | |||
89 | class ResponseExpected(Abort): |
|
89 | class ResponseExpected(Abort): | |
90 | """Raised when an EOF is received for a prompt""" |
|
90 | """Raised when an EOF is received for a prompt""" | |
91 | def __init__(self): |
|
91 | def __init__(self): | |
92 | from .i18n import _ |
|
92 | from .i18n import _ | |
93 | Abort.__init__(self, _('response expected')) |
|
93 | Abort.__init__(self, _('response expected')) | |
94 |
|
94 | |||
95 | class OutOfBandError(Hint, Exception): |
|
95 | class OutOfBandError(Hint, Exception): | |
96 | """Exception raised when a remote repo reports failure""" |
|
96 | """Exception raised when a remote repo reports failure""" | |
97 |
|
97 | |||
98 | class ParseError(Hint, Exception): |
|
98 | class ParseError(Hint, Exception): | |
99 | """Raised when parsing config files and {rev,file}sets (msg[, pos])""" |
|
99 | """Raised when parsing config files and {rev,file}sets (msg[, pos])""" | |
100 |
|
100 | |||
101 | class UnknownIdentifier(ParseError): |
|
101 | class UnknownIdentifier(ParseError): | |
102 | """Exception raised when a {rev,file}set references an unknown identifier""" |
|
102 | """Exception raised when a {rev,file}set references an unknown identifier""" | |
103 |
|
103 | |||
104 | def __init__(self, function, symbols): |
|
104 | def __init__(self, function, symbols): | |
105 | from .i18n import _ |
|
105 | from .i18n import _ | |
106 | ParseError.__init__(self, _("unknown identifier: %s") % function) |
|
106 | ParseError.__init__(self, _("unknown identifier: %s") % function) | |
107 | self.function = function |
|
107 | self.function = function | |
108 | self.symbols = symbols |
|
108 | self.symbols = symbols | |
109 |
|
109 | |||
110 | class RepoError(Hint, Exception): |
|
110 | class RepoError(Hint, Exception): | |
111 | pass |
|
111 | pass | |
112 |
|
112 | |||
113 | class RepoLookupError(RepoError): |
|
113 | class RepoLookupError(RepoError): | |
114 | pass |
|
114 | pass | |
115 |
|
115 | |||
116 | class FilteredRepoLookupError(RepoLookupError): |
|
116 | class FilteredRepoLookupError(RepoLookupError): | |
117 | pass |
|
117 | pass | |
118 |
|
118 | |||
119 | class CapabilityError(RepoError): |
|
119 | class CapabilityError(RepoError): | |
120 | pass |
|
120 | pass | |
121 |
|
121 | |||
122 | class RequirementError(RepoError): |
|
122 | class RequirementError(RepoError): | |
123 | """Exception raised if .hg/requires has an unknown entry.""" |
|
123 | """Exception raised if .hg/requires has an unknown entry.""" | |
124 |
|
124 | |||
125 | class UnsupportedMergeRecords(Abort): |
|
125 | class UnsupportedMergeRecords(Abort): | |
126 | def __init__(self, recordtypes): |
|
126 | def __init__(self, recordtypes): | |
127 | from .i18n import _ |
|
127 | from .i18n import _ | |
128 | self.recordtypes = sorted(recordtypes) |
|
128 | self.recordtypes = sorted(recordtypes) | |
129 | s = ' '.join(self.recordtypes) |
|
129 | s = ' '.join(self.recordtypes) | |
130 | Abort.__init__( |
|
130 | Abort.__init__( | |
131 | self, _('unsupported merge state records: %s') % s, |
|
131 | self, _('unsupported merge state records: %s') % s, | |
132 | hint=_('see https://mercurial-scm.org/wiki/MergeStateRecords for ' |
|
132 | hint=_('see https://mercurial-scm.org/wiki/MergeStateRecords for ' | |
133 | 'more information')) |
|
133 | 'more information')) | |
134 |
|
134 | |||
135 | class LockError(IOError): |
|
135 | class LockError(IOError): | |
136 | def __init__(self, errno, strerror, filename, desc): |
|
136 | def __init__(self, errno, strerror, filename, desc): | |
137 | IOError.__init__(self, errno, strerror, filename) |
|
137 | IOError.__init__(self, errno, strerror, filename) | |
138 | self.desc = desc |
|
138 | self.desc = desc | |
139 |
|
139 | |||
140 | class LockHeld(LockError): |
|
140 | class LockHeld(LockError): | |
141 | def __init__(self, errno, filename, desc, locker): |
|
141 | def __init__(self, errno, filename, desc, locker): | |
142 | LockError.__init__(self, errno, 'Lock held', filename, desc) |
|
142 | LockError.__init__(self, errno, 'Lock held', filename, desc) | |
143 | self.locker = locker |
|
143 | self.locker = locker | |
144 |
|
144 | |||
145 | class LockUnavailable(LockError): |
|
145 | class LockUnavailable(LockError): | |
146 | pass |
|
146 | pass | |
147 |
|
147 | |||
148 | # LockError is for errors while acquiring the lock -- this is unrelated |
|
148 | # LockError is for errors while acquiring the lock -- this is unrelated | |
149 | class LockInheritanceContractViolation(RuntimeError): |
|
149 | class LockInheritanceContractViolation(RuntimeError): | |
150 | pass |
|
150 | pass | |
151 |
|
151 | |||
152 | class ResponseError(Exception): |
|
152 | class ResponseError(Exception): | |
153 | """Raised to print an error with part of output and exit.""" |
|
153 | """Raised to print an error with part of output and exit.""" | |
154 |
|
154 | |||
155 | class UnknownCommand(Exception): |
|
155 | class UnknownCommand(Exception): | |
156 | """Exception raised if command is not in the command table.""" |
|
156 | """Exception raised if command is not in the command table.""" | |
157 |
|
157 | |||
158 | class AmbiguousCommand(Exception): |
|
158 | class AmbiguousCommand(Exception): | |
159 | """Exception raised if command shortcut matches more than one command.""" |
|
159 | """Exception raised if command shortcut matches more than one command.""" | |
160 |
|
160 | |||
161 | # derived from KeyboardInterrupt to simplify some breakout code |
|
161 | # derived from KeyboardInterrupt to simplify some breakout code | |
162 | class SignalInterrupt(KeyboardInterrupt): |
|
162 | class SignalInterrupt(KeyboardInterrupt): | |
163 | """Exception raised on SIGTERM and SIGHUP.""" |
|
163 | """Exception raised on SIGTERM and SIGHUP.""" | |
164 |
|
164 | |||
165 | class SignatureError(Exception): |
|
165 | class SignatureError(Exception): | |
166 | pass |
|
166 | pass | |
167 |
|
167 | |||
168 | class PushRaced(RuntimeError): |
|
168 | class PushRaced(RuntimeError): | |
169 | """An exception raised during unbundling that indicate a push race""" |
|
169 | """An exception raised during unbundling that indicate a push race""" | |
170 |
|
170 | |||
171 | # bundle2 related errors |
|
171 | # bundle2 related errors | |
172 | class BundleValueError(ValueError): |
|
172 | class BundleValueError(ValueError): | |
173 | """error raised when bundle2 cannot be processed""" |
|
173 | """error raised when bundle2 cannot be processed""" | |
174 |
|
174 | |||
175 | class BundleUnknownFeatureError(BundleValueError): |
|
175 | class BundleUnknownFeatureError(BundleValueError): | |
176 | def __init__(self, parttype=None, params=(), values=()): |
|
176 | def __init__(self, parttype=None, params=(), values=()): | |
177 | self.parttype = parttype |
|
177 | self.parttype = parttype | |
178 | self.params = params |
|
178 | self.params = params | |
179 | self.values = values |
|
179 | self.values = values | |
180 | if self.parttype is None: |
|
180 | if self.parttype is None: | |
181 | msg = 'Stream Parameter' |
|
181 | msg = 'Stream Parameter' | |
182 | else: |
|
182 | else: | |
183 | msg = parttype |
|
183 | msg = parttype | |
184 | entries = self.params |
|
184 | entries = self.params | |
185 | if self.params and self.values: |
|
185 | if self.params and self.values: | |
186 | assert len(self.params) == len(self.values) |
|
186 | assert len(self.params) == len(self.values) | |
187 | entries = [] |
|
187 | entries = [] | |
188 | for idx, par in enumerate(self.params): |
|
188 | for idx, par in enumerate(self.params): | |
189 | val = self.values[idx] |
|
189 | val = self.values[idx] | |
190 | if val is None: |
|
190 | if val is None: | |
191 | entries.append(val) |
|
191 | entries.append(val) | |
192 | else: |
|
192 | else: | |
193 | entries.append("%s=%r" % (par, val)) |
|
193 | entries.append("%s=%r" % (par, val)) | |
194 | if entries: |
|
194 | if entries: | |
195 | msg = '%s - %s' % (msg, ', '.join(entries)) |
|
195 | msg = '%s - %s' % (msg, ', '.join(entries)) | |
196 | ValueError.__init__(self, msg) |
|
196 | ValueError.__init__(self, msg) | |
197 |
|
197 | |||
198 | class ReadOnlyPartError(RuntimeError): |
|
198 | class ReadOnlyPartError(RuntimeError): | |
199 | """error raised when code tries to alter a part being generated""" |
|
199 | """error raised when code tries to alter a part being generated""" | |
200 |
|
200 | |||
201 | class PushkeyFailed(Abort): |
|
201 | class PushkeyFailed(Abort): | |
202 | """error raised when a pushkey part failed to update a value""" |
|
202 | """error raised when a pushkey part failed to update a value""" | |
203 |
|
203 | |||
204 | def __init__(self, partid, namespace=None, key=None, new=None, old=None, |
|
204 | def __init__(self, partid, namespace=None, key=None, new=None, old=None, | |
205 | ret=None): |
|
205 | ret=None): | |
206 | self.partid = partid |
|
206 | self.partid = partid | |
207 | self.namespace = namespace |
|
207 | self.namespace = namespace | |
208 | self.key = key |
|
208 | self.key = key | |
209 | self.new = new |
|
209 | self.new = new | |
210 | self.old = old |
|
210 | self.old = old | |
211 | self.ret = ret |
|
211 | self.ret = ret | |
212 | # no i18n expected to be processed into a better message |
|
212 | # no i18n expected to be processed into a better message | |
213 | Abort.__init__(self, 'failed to update value for "%s/%s"' |
|
213 | Abort.__init__(self, 'failed to update value for "%s/%s"' | |
214 | % (namespace, key)) |
|
214 | % (namespace, key)) | |
215 |
|
215 | |||
216 | class CensoredNodeError(RevlogError): |
|
216 | class CensoredNodeError(RevlogError): | |
217 | """error raised when content verification fails on a censored node |
|
217 | """error raised when content verification fails on a censored node | |
218 |
|
218 | |||
219 | Also contains the tombstone data substituted for the uncensored data. |
|
219 | Also contains the tombstone data substituted for the uncensored data. | |
220 | """ |
|
220 | """ | |
221 |
|
221 | |||
222 | def __init__(self, filename, node, tombstone): |
|
222 | def __init__(self, filename, node, tombstone): | |
223 | from .node import short |
|
223 | from .node import short | |
224 | RevlogError.__init__(self, '%s:%s' % (filename, short(node))) |
|
224 | RevlogError.__init__(self, '%s:%s' % (filename, short(node))) | |
225 | self.tombstone = tombstone |
|
225 | self.tombstone = tombstone | |
226 |
|
226 | |||
227 | class CensoredBaseError(RevlogError): |
|
227 | class CensoredBaseError(RevlogError): | |
228 | """error raised when a delta is rejected because its base is censored |
|
228 | """error raised when a delta is rejected because its base is censored | |
229 |
|
229 | |||
230 | A delta based on a censored revision must be formed as single patch |
|
230 | A delta based on a censored revision must be formed as single patch | |
231 | operation which replaces the entire base with new content. This ensures |
|
231 | operation which replaces the entire base with new content. This ensures | |
232 | the delta may be applied by clones which have not censored the base. |
|
232 | the delta may be applied by clones which have not censored the base. | |
233 | """ |
|
233 | """ | |
234 |
|
234 | |||
235 | class InvalidBundleSpecification(Exception): |
|
235 | class InvalidBundleSpecification(Exception): | |
236 | """error raised when a bundle specification is invalid. |
|
236 | """error raised when a bundle specification is invalid. | |
237 |
|
237 | |||
238 | This is used for syntax errors as opposed to support errors. |
|
238 | This is used for syntax errors as opposed to support errors. | |
239 | """ |
|
239 | """ | |
240 |
|
240 | |||
241 | class UnsupportedBundleSpecification(Exception): |
|
241 | class UnsupportedBundleSpecification(Exception): | |
242 | """error raised when a bundle specification is not supported.""" |
|
242 | """error raised when a bundle specification is not supported.""" | |
|
243 | ||||
|
244 | class CorruptedState(Exception): | |||
|
245 | """error raised when a command is not able to read its state from file""" |
@@ -1,1587 +1,1624 | |||||
1 | $ cat <<EOF >> $HGRCPATH |
|
1 | $ cat <<EOF >> $HGRCPATH | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > mq = |
|
3 | > mq = | |
4 | > shelve = |
|
4 | > shelve = | |
5 | > [defaults] |
|
5 | > [defaults] | |
6 | > diff = --nodates --git |
|
6 | > diff = --nodates --git | |
7 | > qnew = --date '0 0' |
|
7 | > qnew = --date '0 0' | |
8 | > [shelve] |
|
8 | > [shelve] | |
9 | > maxbackups = 2 |
|
9 | > maxbackups = 2 | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 | $ hg init repo |
|
12 | $ hg init repo | |
13 | $ cd repo |
|
13 | $ cd repo | |
14 | $ mkdir a b |
|
14 | $ mkdir a b | |
15 | $ echo a > a/a |
|
15 | $ echo a > a/a | |
16 | $ echo b > b/b |
|
16 | $ echo b > b/b | |
17 | $ echo c > c |
|
17 | $ echo c > c | |
18 | $ echo d > d |
|
18 | $ echo d > d | |
19 | $ echo x > x |
|
19 | $ echo x > x | |
20 | $ hg addremove -q |
|
20 | $ hg addremove -q | |
21 |
|
21 | |||
22 | shelve has a help message |
|
22 | shelve has a help message | |
23 | $ hg shelve -h |
|
23 | $ hg shelve -h | |
24 | hg shelve [OPTION]... [FILE]... |
|
24 | hg shelve [OPTION]... [FILE]... | |
25 |
|
25 | |||
26 | save and set aside changes from the working directory |
|
26 | save and set aside changes from the working directory | |
27 |
|
27 | |||
28 | Shelving takes files that "hg status" reports as not clean, saves the |
|
28 | Shelving takes files that "hg status" reports as not clean, saves the | |
29 | modifications to a bundle (a shelved change), and reverts the files so |
|
29 | modifications to a bundle (a shelved change), and reverts the files so | |
30 | that their state in the working directory becomes clean. |
|
30 | that their state in the working directory becomes clean. | |
31 |
|
31 | |||
32 | To restore these changes to the working directory, using "hg unshelve"; |
|
32 | To restore these changes to the working directory, using "hg unshelve"; | |
33 | this will work even if you switch to a different commit. |
|
33 | this will work even if you switch to a different commit. | |
34 |
|
34 | |||
35 | When no files are specified, "hg shelve" saves all not-clean files. If |
|
35 | When no files are specified, "hg shelve" saves all not-clean files. If | |
36 | specific files or directories are named, only changes to those files are |
|
36 | specific files or directories are named, only changes to those files are | |
37 | shelved. |
|
37 | shelved. | |
38 |
|
38 | |||
39 | In bare shelve(when no files are specified, without interactive, include |
|
39 | In bare shelve(when no files are specified, without interactive, include | |
40 | and exclude option), shelving remembers information if the working |
|
40 | and exclude option), shelving remembers information if the working | |
41 | directory was on newly created branch, in other words working directory |
|
41 | directory was on newly created branch, in other words working directory | |
42 | was on different branch than its first parent. In this situation |
|
42 | was on different branch than its first parent. In this situation | |
43 | unshelving restores branch information to the working directory. |
|
43 | unshelving restores branch information to the working directory. | |
44 |
|
44 | |||
45 | Each shelved change has a name that makes it easier to find later. The |
|
45 | Each shelved change has a name that makes it easier to find later. The | |
46 | name of a shelved change defaults to being based on the active bookmark, |
|
46 | name of a shelved change defaults to being based on the active bookmark, | |
47 | or if there is no active bookmark, the current named branch. To specify a |
|
47 | or if there is no active bookmark, the current named branch. To specify a | |
48 | different name, use "--name". |
|
48 | different name, use "--name". | |
49 |
|
49 | |||
50 | To see a list of existing shelved changes, use the "--list" option. For |
|
50 | To see a list of existing shelved changes, use the "--list" option. For | |
51 | each shelved change, this will print its name, age, and description; use " |
|
51 | each shelved change, this will print its name, age, and description; use " | |
52 | --patch" or "--stat" for more details. |
|
52 | --patch" or "--stat" for more details. | |
53 |
|
53 | |||
54 | To delete specific shelved changes, use "--delete". To delete all shelved |
|
54 | To delete specific shelved changes, use "--delete". To delete all shelved | |
55 | changes, use "--cleanup". |
|
55 | changes, use "--cleanup". | |
56 |
|
56 | |||
57 | (use "hg help -e shelve" to show help for the shelve extension) |
|
57 | (use "hg help -e shelve" to show help for the shelve extension) | |
58 |
|
58 | |||
59 | options ([+] can be repeated): |
|
59 | options ([+] can be repeated): | |
60 |
|
60 | |||
61 | -A --addremove mark new/missing files as added/removed before |
|
61 | -A --addremove mark new/missing files as added/removed before | |
62 | shelving |
|
62 | shelving | |
63 | -u --unknown store unknown files in the shelve |
|
63 | -u --unknown store unknown files in the shelve | |
64 | --cleanup delete all shelved changes |
|
64 | --cleanup delete all shelved changes | |
65 | --date DATE shelve with the specified commit date |
|
65 | --date DATE shelve with the specified commit date | |
66 | -d --delete delete the named shelved change(s) |
|
66 | -d --delete delete the named shelved change(s) | |
67 | -e --edit invoke editor on commit messages |
|
67 | -e --edit invoke editor on commit messages | |
68 | -l --list list current shelves |
|
68 | -l --list list current shelves | |
69 | -m --message TEXT use text as shelve message |
|
69 | -m --message TEXT use text as shelve message | |
70 | -n --name NAME use the given name for the shelved commit |
|
70 | -n --name NAME use the given name for the shelved commit | |
71 | -p --patch show patch |
|
71 | -p --patch show patch | |
72 | -i --interactive interactive mode, only works while creating a shelve |
|
72 | -i --interactive interactive mode, only works while creating a shelve | |
73 | --stat output diffstat-style summary of changes |
|
73 | --stat output diffstat-style summary of changes | |
74 | -I --include PATTERN [+] include names matching the given patterns |
|
74 | -I --include PATTERN [+] include names matching the given patterns | |
75 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
75 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
76 | --mq operate on patch repository |
|
76 | --mq operate on patch repository | |
77 |
|
77 | |||
78 | (some details hidden, use --verbose to show complete help) |
|
78 | (some details hidden, use --verbose to show complete help) | |
79 |
|
79 | |||
80 | shelving in an empty repo should be possible |
|
80 | shelving in an empty repo should be possible | |
81 | (this tests also that editor is not invoked, if '--edit' is not |
|
81 | (this tests also that editor is not invoked, if '--edit' is not | |
82 | specified) |
|
82 | specified) | |
83 |
|
83 | |||
84 | $ HGEDITOR=cat hg shelve |
|
84 | $ HGEDITOR=cat hg shelve | |
85 | shelved as default |
|
85 | shelved as default | |
86 | 0 files updated, 0 files merged, 5 files removed, 0 files unresolved |
|
86 | 0 files updated, 0 files merged, 5 files removed, 0 files unresolved | |
87 |
|
87 | |||
88 | $ hg unshelve |
|
88 | $ hg unshelve | |
89 | unshelving change 'default' |
|
89 | unshelving change 'default' | |
90 |
|
90 | |||
91 | $ hg commit -q -m 'initial commit' |
|
91 | $ hg commit -q -m 'initial commit' | |
92 |
|
92 | |||
93 | $ hg shelve |
|
93 | $ hg shelve | |
94 | nothing changed |
|
94 | nothing changed | |
95 | [1] |
|
95 | [1] | |
96 |
|
96 | |||
97 | make sure shelve files were backed up |
|
97 | make sure shelve files were backed up | |
98 |
|
98 | |||
99 | $ ls .hg/shelve-backup |
|
99 | $ ls .hg/shelve-backup | |
100 | default.hg |
|
100 | default.hg | |
101 | default.patch |
|
101 | default.patch | |
102 |
|
102 | |||
103 | create an mq patch - shelving should work fine with a patch applied |
|
103 | create an mq patch - shelving should work fine with a patch applied | |
104 |
|
104 | |||
105 | $ echo n > n |
|
105 | $ echo n > n | |
106 | $ hg add n |
|
106 | $ hg add n | |
107 | $ hg commit n -m second |
|
107 | $ hg commit n -m second | |
108 | $ hg qnew second.patch |
|
108 | $ hg qnew second.patch | |
109 |
|
109 | |||
110 | shelve a change that we will delete later |
|
110 | shelve a change that we will delete later | |
111 |
|
111 | |||
112 | $ echo a >> a/a |
|
112 | $ echo a >> a/a | |
113 | $ hg shelve |
|
113 | $ hg shelve | |
114 | shelved as default |
|
114 | shelved as default | |
115 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
115 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
116 |
|
116 | |||
117 | set up some more complex changes to shelve |
|
117 | set up some more complex changes to shelve | |
118 |
|
118 | |||
119 | $ echo a >> a/a |
|
119 | $ echo a >> a/a | |
120 | $ hg mv b b.rename |
|
120 | $ hg mv b b.rename | |
121 | moving b/b to b.rename/b (glob) |
|
121 | moving b/b to b.rename/b (glob) | |
122 | $ hg cp c c.copy |
|
122 | $ hg cp c c.copy | |
123 | $ hg status -C |
|
123 | $ hg status -C | |
124 | M a/a |
|
124 | M a/a | |
125 | A b.rename/b |
|
125 | A b.rename/b | |
126 | b/b |
|
126 | b/b | |
127 | A c.copy |
|
127 | A c.copy | |
128 | c |
|
128 | c | |
129 | R b/b |
|
129 | R b/b | |
130 |
|
130 | |||
131 | prevent some foot-shooting |
|
131 | prevent some foot-shooting | |
132 |
|
132 | |||
133 | $ hg shelve -n foo/bar |
|
133 | $ hg shelve -n foo/bar | |
134 | abort: shelved change names may not contain slashes |
|
134 | abort: shelved change names may not contain slashes | |
135 | [255] |
|
135 | [255] | |
136 | $ hg shelve -n .baz |
|
136 | $ hg shelve -n .baz | |
137 | abort: shelved change names may not start with '.' |
|
137 | abort: shelved change names may not start with '.' | |
138 | [255] |
|
138 | [255] | |
139 |
|
139 | |||
140 | the common case - no options or filenames |
|
140 | the common case - no options or filenames | |
141 |
|
141 | |||
142 | $ hg shelve |
|
142 | $ hg shelve | |
143 | shelved as default-01 |
|
143 | shelved as default-01 | |
144 | 2 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
144 | 2 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
145 | $ hg status -C |
|
145 | $ hg status -C | |
146 |
|
146 | |||
147 | ensure that our shelved changes exist |
|
147 | ensure that our shelved changes exist | |
148 |
|
148 | |||
149 | $ hg shelve -l |
|
149 | $ hg shelve -l | |
150 | default-01 (*)* changes to: [mq]: second.patch (glob) |
|
150 | default-01 (*)* changes to: [mq]: second.patch (glob) | |
151 | default (*)* changes to: [mq]: second.patch (glob) |
|
151 | default (*)* changes to: [mq]: second.patch (glob) | |
152 |
|
152 | |||
153 | $ hg shelve -l -p default |
|
153 | $ hg shelve -l -p default | |
154 | default (*)* changes to: [mq]: second.patch (glob) |
|
154 | default (*)* changes to: [mq]: second.patch (glob) | |
155 |
|
155 | |||
156 | diff --git a/a/a b/a/a |
|
156 | diff --git a/a/a b/a/a | |
157 | --- a/a/a |
|
157 | --- a/a/a | |
158 | +++ b/a/a |
|
158 | +++ b/a/a | |
159 | @@ -1,1 +1,2 @@ |
|
159 | @@ -1,1 +1,2 @@ | |
160 | a |
|
160 | a | |
161 | +a |
|
161 | +a | |
162 |
|
162 | |||
163 | $ hg shelve --list --addremove |
|
163 | $ hg shelve --list --addremove | |
164 | abort: options '--list' and '--addremove' may not be used together |
|
164 | abort: options '--list' and '--addremove' may not be used together | |
165 | [255] |
|
165 | [255] | |
166 |
|
166 | |||
167 | delete our older shelved change |
|
167 | delete our older shelved change | |
168 |
|
168 | |||
169 | $ hg shelve -d default |
|
169 | $ hg shelve -d default | |
170 | $ hg qfinish -a -q |
|
170 | $ hg qfinish -a -q | |
171 |
|
171 | |||
172 | ensure shelve backups aren't overwritten |
|
172 | ensure shelve backups aren't overwritten | |
173 |
|
173 | |||
174 | $ ls .hg/shelve-backup/ |
|
174 | $ ls .hg/shelve-backup/ | |
175 | default-1.hg |
|
175 | default-1.hg | |
176 | default-1.patch |
|
176 | default-1.patch | |
177 | default.hg |
|
177 | default.hg | |
178 | default.patch |
|
178 | default.patch | |
179 |
|
179 | |||
180 | local edits should not prevent a shelved change from applying |
|
180 | local edits should not prevent a shelved change from applying | |
181 |
|
181 | |||
182 | $ printf "z\na\n" > a/a |
|
182 | $ printf "z\na\n" > a/a | |
183 | $ hg unshelve --keep |
|
183 | $ hg unshelve --keep | |
184 | unshelving change 'default-01' |
|
184 | unshelving change 'default-01' | |
185 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
185 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
186 | rebasing shelved changes |
|
186 | rebasing shelved changes | |
187 | rebasing 4:32c69314e062 "changes to: [mq]: second.patch" (tip) |
|
187 | rebasing 4:32c69314e062 "changes to: [mq]: second.patch" (tip) | |
188 | merging a/a |
|
188 | merging a/a | |
189 |
|
189 | |||
190 | $ hg revert --all -q |
|
190 | $ hg revert --all -q | |
191 | $ rm a/a.orig b.rename/b c.copy |
|
191 | $ rm a/a.orig b.rename/b c.copy | |
192 |
|
192 | |||
193 | apply it and make sure our state is as expected |
|
193 | apply it and make sure our state is as expected | |
194 |
|
194 | |||
195 | (this also tests that same timestamp prevents backups from being |
|
195 | (this also tests that same timestamp prevents backups from being | |
196 | removed, even though there are more than 'maxbackups' backups) |
|
196 | removed, even though there are more than 'maxbackups' backups) | |
197 |
|
197 | |||
198 | $ f -t .hg/shelve-backup/default.hg |
|
198 | $ f -t .hg/shelve-backup/default.hg | |
199 | .hg/shelve-backup/default.hg: file |
|
199 | .hg/shelve-backup/default.hg: file | |
200 | $ touch -t 200001010000 .hg/shelve-backup/default.hg |
|
200 | $ touch -t 200001010000 .hg/shelve-backup/default.hg | |
201 | $ f -t .hg/shelve-backup/default-1.hg |
|
201 | $ f -t .hg/shelve-backup/default-1.hg | |
202 | .hg/shelve-backup/default-1.hg: file |
|
202 | .hg/shelve-backup/default-1.hg: file | |
203 | $ touch -t 200001010000 .hg/shelve-backup/default-1.hg |
|
203 | $ touch -t 200001010000 .hg/shelve-backup/default-1.hg | |
204 |
|
204 | |||
205 | $ hg unshelve |
|
205 | $ hg unshelve | |
206 | unshelving change 'default-01' |
|
206 | unshelving change 'default-01' | |
207 | $ hg status -C |
|
207 | $ hg status -C | |
208 | M a/a |
|
208 | M a/a | |
209 | A b.rename/b |
|
209 | A b.rename/b | |
210 | b/b |
|
210 | b/b | |
211 | A c.copy |
|
211 | A c.copy | |
212 | c |
|
212 | c | |
213 | R b/b |
|
213 | R b/b | |
214 | $ hg shelve -l |
|
214 | $ hg shelve -l | |
215 |
|
215 | |||
216 | (both of default.hg and default-1.hg should be still kept, because it |
|
216 | (both of default.hg and default-1.hg should be still kept, because it | |
217 | is difficult to decide actual order of them from same timestamp) |
|
217 | is difficult to decide actual order of them from same timestamp) | |
218 |
|
218 | |||
219 | $ ls .hg/shelve-backup/ |
|
219 | $ ls .hg/shelve-backup/ | |
220 | default-01.hg |
|
220 | default-01.hg | |
221 | default-01.patch |
|
221 | default-01.patch | |
222 | default-1.hg |
|
222 | default-1.hg | |
223 | default-1.patch |
|
223 | default-1.patch | |
224 | default.hg |
|
224 | default.hg | |
225 | default.patch |
|
225 | default.patch | |
226 |
|
226 | |||
227 | $ hg unshelve |
|
227 | $ hg unshelve | |
228 | abort: no shelved changes to apply! |
|
228 | abort: no shelved changes to apply! | |
229 | [255] |
|
229 | [255] | |
230 | $ hg unshelve foo |
|
230 | $ hg unshelve foo | |
231 | abort: shelved change 'foo' not found |
|
231 | abort: shelved change 'foo' not found | |
232 | [255] |
|
232 | [255] | |
233 |
|
233 | |||
234 | named shelves, specific filenames, and "commit messages" should all work |
|
234 | named shelves, specific filenames, and "commit messages" should all work | |
235 | (this tests also that editor is invoked, if '--edit' is specified) |
|
235 | (this tests also that editor is invoked, if '--edit' is specified) | |
236 |
|
236 | |||
237 | $ hg status -C |
|
237 | $ hg status -C | |
238 | M a/a |
|
238 | M a/a | |
239 | A b.rename/b |
|
239 | A b.rename/b | |
240 | b/b |
|
240 | b/b | |
241 | A c.copy |
|
241 | A c.copy | |
242 | c |
|
242 | c | |
243 | R b/b |
|
243 | R b/b | |
244 | $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a |
|
244 | $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a | |
245 | wat |
|
245 | wat | |
246 |
|
246 | |||
247 |
|
247 | |||
248 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
248 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
249 | HG: Leave message empty to abort commit. |
|
249 | HG: Leave message empty to abort commit. | |
250 | HG: -- |
|
250 | HG: -- | |
251 | HG: user: shelve@localhost |
|
251 | HG: user: shelve@localhost | |
252 | HG: branch 'default' |
|
252 | HG: branch 'default' | |
253 | HG: changed a/a |
|
253 | HG: changed a/a | |
254 |
|
254 | |||
255 | expect "a" to no longer be present, but status otherwise unchanged |
|
255 | expect "a" to no longer be present, but status otherwise unchanged | |
256 |
|
256 | |||
257 | $ hg status -C |
|
257 | $ hg status -C | |
258 | A b.rename/b |
|
258 | A b.rename/b | |
259 | b/b |
|
259 | b/b | |
260 | A c.copy |
|
260 | A c.copy | |
261 | c |
|
261 | c | |
262 | R b/b |
|
262 | R b/b | |
263 | $ hg shelve -l --stat |
|
263 | $ hg shelve -l --stat | |
264 | wibble (*) wat (glob) |
|
264 | wibble (*) wat (glob) | |
265 | a/a | 1 + |
|
265 | a/a | 1 + | |
266 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
266 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
267 |
|
267 | |||
268 | and now "a/a" should reappear |
|
268 | and now "a/a" should reappear | |
269 |
|
269 | |||
270 | $ cd a |
|
270 | $ cd a | |
271 | $ hg unshelve -q wibble |
|
271 | $ hg unshelve -q wibble | |
272 | $ cd .. |
|
272 | $ cd .. | |
273 | $ hg status -C |
|
273 | $ hg status -C | |
274 | M a/a |
|
274 | M a/a | |
275 | A b.rename/b |
|
275 | A b.rename/b | |
276 | b/b |
|
276 | b/b | |
277 | A c.copy |
|
277 | A c.copy | |
278 | c |
|
278 | c | |
279 | R b/b |
|
279 | R b/b | |
280 |
|
280 | |||
281 | ensure old shelve backups are being deleted automatically |
|
281 | ensure old shelve backups are being deleted automatically | |
282 |
|
282 | |||
283 | $ ls .hg/shelve-backup/ |
|
283 | $ ls .hg/shelve-backup/ | |
284 | default-01.hg |
|
284 | default-01.hg | |
285 | default-01.patch |
|
285 | default-01.patch | |
286 | wibble.hg |
|
286 | wibble.hg | |
287 | wibble.patch |
|
287 | wibble.patch | |
288 |
|
288 | |||
289 | cause unshelving to result in a merge with 'a' conflicting |
|
289 | cause unshelving to result in a merge with 'a' conflicting | |
290 |
|
290 | |||
291 | $ hg shelve -q |
|
291 | $ hg shelve -q | |
292 | $ echo c>>a/a |
|
292 | $ echo c>>a/a | |
293 | $ hg commit -m second |
|
293 | $ hg commit -m second | |
294 | $ hg tip --template '{files}\n' |
|
294 | $ hg tip --template '{files}\n' | |
295 | a/a |
|
295 | a/a | |
296 |
|
296 | |||
297 | add an unrelated change that should be preserved |
|
297 | add an unrelated change that should be preserved | |
298 |
|
298 | |||
299 | $ mkdir foo |
|
299 | $ mkdir foo | |
300 | $ echo foo > foo/foo |
|
300 | $ echo foo > foo/foo | |
301 | $ hg add foo/foo |
|
301 | $ hg add foo/foo | |
302 |
|
302 | |||
303 | force a conflicted merge to occur |
|
303 | force a conflicted merge to occur | |
304 |
|
304 | |||
305 | $ hg unshelve |
|
305 | $ hg unshelve | |
306 | unshelving change 'default' |
|
306 | unshelving change 'default' | |
307 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
307 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
308 | rebasing shelved changes |
|
308 | rebasing shelved changes | |
309 | rebasing 5:32c69314e062 "changes to: [mq]: second.patch" (tip) |
|
309 | rebasing 5:32c69314e062 "changes to: [mq]: second.patch" (tip) | |
310 | merging a/a |
|
310 | merging a/a | |
311 | warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') |
|
311 | warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') | |
312 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
312 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
313 | [1] |
|
313 | [1] | |
314 |
|
314 | |||
315 | ensure that we have a merge with unresolved conflicts |
|
315 | ensure that we have a merge with unresolved conflicts | |
316 |
|
316 | |||
317 | $ hg heads -q --template '{rev}\n' |
|
317 | $ hg heads -q --template '{rev}\n' | |
318 | 5 |
|
318 | 5 | |
319 | 4 |
|
319 | 4 | |
320 | $ hg parents -q --template '{rev}\n' |
|
320 | $ hg parents -q --template '{rev}\n' | |
321 | 4 |
|
321 | 4 | |
322 | 5 |
|
322 | 5 | |
323 | $ hg status |
|
323 | $ hg status | |
324 | M a/a |
|
324 | M a/a | |
325 | M b.rename/b |
|
325 | M b.rename/b | |
326 | M c.copy |
|
326 | M c.copy | |
327 | R b/b |
|
327 | R b/b | |
328 | ? a/a.orig |
|
328 | ? a/a.orig | |
329 | $ hg diff |
|
329 | $ hg diff | |
330 | diff --git a/a/a b/a/a |
|
330 | diff --git a/a/a b/a/a | |
331 | --- a/a/a |
|
331 | --- a/a/a | |
332 | +++ b/a/a |
|
332 | +++ b/a/a | |
333 | @@ -1,2 +1,6 @@ |
|
333 | @@ -1,2 +1,6 @@ | |
334 | a |
|
334 | a | |
335 | +<<<<<<< dest: * - shelve: pending changes temporary commit (glob) |
|
335 | +<<<<<<< dest: * - shelve: pending changes temporary commit (glob) | |
336 | c |
|
336 | c | |
337 | +======= |
|
337 | +======= | |
338 | +a |
|
338 | +a | |
339 | +>>>>>>> source: 32c69314e062 - shelve: changes to: [mq]: second.patch |
|
339 | +>>>>>>> source: 32c69314e062 - shelve: changes to: [mq]: second.patch | |
340 | diff --git a/b/b b/b.rename/b |
|
340 | diff --git a/b/b b/b.rename/b | |
341 | rename from b/b |
|
341 | rename from b/b | |
342 | rename to b.rename/b |
|
342 | rename to b.rename/b | |
343 | diff --git a/c b/c.copy |
|
343 | diff --git a/c b/c.copy | |
344 | copy from c |
|
344 | copy from c | |
345 | copy to c.copy |
|
345 | copy to c.copy | |
346 | $ hg resolve -l |
|
346 | $ hg resolve -l | |
347 | U a/a |
|
347 | U a/a | |
348 |
|
348 | |||
349 | $ hg shelve |
|
349 | $ hg shelve | |
350 | abort: unshelve already in progress |
|
350 | abort: unshelve already in progress | |
351 | (use 'hg unshelve --continue' or 'hg unshelve --abort') |
|
351 | (use 'hg unshelve --continue' or 'hg unshelve --abort') | |
352 | [255] |
|
352 | [255] | |
353 |
|
353 | |||
354 | abort the unshelve and be happy |
|
354 | abort the unshelve and be happy | |
355 |
|
355 | |||
356 | $ hg status |
|
356 | $ hg status | |
357 | M a/a |
|
357 | M a/a | |
358 | M b.rename/b |
|
358 | M b.rename/b | |
359 | M c.copy |
|
359 | M c.copy | |
360 | R b/b |
|
360 | R b/b | |
361 | ? a/a.orig |
|
361 | ? a/a.orig | |
362 | $ hg unshelve -a |
|
362 | $ hg unshelve -a | |
363 | rebase aborted |
|
363 | rebase aborted | |
364 | unshelve of 'default' aborted |
|
364 | unshelve of 'default' aborted | |
365 | $ hg heads -q |
|
365 | $ hg heads -q | |
366 | 3:2e69b451d1ea |
|
366 | 3:2e69b451d1ea | |
367 | $ hg parents |
|
367 | $ hg parents | |
368 | changeset: 3:2e69b451d1ea |
|
368 | changeset: 3:2e69b451d1ea | |
369 | tag: tip |
|
369 | tag: tip | |
370 | user: test |
|
370 | user: test | |
371 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
371 | date: Thu Jan 01 00:00:00 1970 +0000 | |
372 | summary: second |
|
372 | summary: second | |
373 |
|
373 | |||
374 | $ hg resolve -l |
|
374 | $ hg resolve -l | |
375 | $ hg status |
|
375 | $ hg status | |
376 | A foo/foo |
|
376 | A foo/foo | |
377 | ? a/a.orig |
|
377 | ? a/a.orig | |
378 |
|
378 | |||
379 | try to continue with no unshelve underway |
|
379 | try to continue with no unshelve underway | |
380 |
|
380 | |||
381 | $ hg unshelve -c |
|
381 | $ hg unshelve -c | |
382 | abort: no unshelve in progress |
|
382 | abort: no unshelve in progress | |
383 | [255] |
|
383 | [255] | |
384 | $ hg status |
|
384 | $ hg status | |
385 | A foo/foo |
|
385 | A foo/foo | |
386 | ? a/a.orig |
|
386 | ? a/a.orig | |
387 |
|
387 | |||
388 | redo the unshelve to get a conflict |
|
388 | redo the unshelve to get a conflict | |
389 |
|
389 | |||
390 | $ hg unshelve -q |
|
390 | $ hg unshelve -q | |
391 | warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') |
|
391 | warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') | |
392 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
392 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
393 | [1] |
|
393 | [1] | |
394 |
|
394 | |||
395 | attempt to continue |
|
395 | attempt to continue | |
396 |
|
396 | |||
397 | $ hg unshelve -c |
|
397 | $ hg unshelve -c | |
398 | abort: unresolved conflicts, can't continue |
|
398 | abort: unresolved conflicts, can't continue | |
399 | (see 'hg resolve', then 'hg unshelve --continue') |
|
399 | (see 'hg resolve', then 'hg unshelve --continue') | |
400 | [255] |
|
400 | [255] | |
401 |
|
401 | |||
402 | $ hg revert -r . a/a |
|
402 | $ hg revert -r . a/a | |
403 | $ hg resolve -m a/a |
|
403 | $ hg resolve -m a/a | |
404 | (no more unresolved files) |
|
404 | (no more unresolved files) | |
405 | continue: hg unshelve --continue |
|
405 | continue: hg unshelve --continue | |
406 |
|
406 | |||
407 | $ hg commit -m 'commit while unshelve in progress' |
|
407 | $ hg commit -m 'commit while unshelve in progress' | |
408 | abort: unshelve already in progress |
|
408 | abort: unshelve already in progress | |
409 | (use 'hg unshelve --continue' or 'hg unshelve --abort') |
|
409 | (use 'hg unshelve --continue' or 'hg unshelve --abort') | |
410 | [255] |
|
410 | [255] | |
411 |
|
411 | |||
412 | $ hg graft --continue |
|
412 | $ hg graft --continue | |
413 | abort: no graft in progress |
|
413 | abort: no graft in progress | |
414 | (continue: hg unshelve --continue) |
|
414 | (continue: hg unshelve --continue) | |
415 | [255] |
|
415 | [255] | |
416 | $ hg unshelve -c |
|
416 | $ hg unshelve -c | |
417 | rebasing 5:32c69314e062 "changes to: [mq]: second.patch" (tip) |
|
417 | rebasing 5:32c69314e062 "changes to: [mq]: second.patch" (tip) | |
418 | unshelve of 'default' complete |
|
418 | unshelve of 'default' complete | |
419 |
|
419 | |||
420 | ensure the repo is as we hope |
|
420 | ensure the repo is as we hope | |
421 |
|
421 | |||
422 | $ hg parents |
|
422 | $ hg parents | |
423 | changeset: 3:2e69b451d1ea |
|
423 | changeset: 3:2e69b451d1ea | |
424 | tag: tip |
|
424 | tag: tip | |
425 | user: test |
|
425 | user: test | |
426 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
426 | date: Thu Jan 01 00:00:00 1970 +0000 | |
427 | summary: second |
|
427 | summary: second | |
428 |
|
428 | |||
429 | $ hg heads -q |
|
429 | $ hg heads -q | |
430 | 3:2e69b451d1ea |
|
430 | 3:2e69b451d1ea | |
431 |
|
431 | |||
432 | $ hg status -C |
|
432 | $ hg status -C | |
433 | A b.rename/b |
|
433 | A b.rename/b | |
434 | b/b |
|
434 | b/b | |
435 | A c.copy |
|
435 | A c.copy | |
436 | c |
|
436 | c | |
437 | A foo/foo |
|
437 | A foo/foo | |
438 | R b/b |
|
438 | R b/b | |
439 | ? a/a.orig |
|
439 | ? a/a.orig | |
440 |
|
440 | |||
441 | there should be no shelves left |
|
441 | there should be no shelves left | |
442 |
|
442 | |||
443 | $ hg shelve -l |
|
443 | $ hg shelve -l | |
444 |
|
444 | |||
445 | #if execbit |
|
445 | #if execbit | |
446 |
|
446 | |||
447 | ensure that metadata-only changes are shelved |
|
447 | ensure that metadata-only changes are shelved | |
448 |
|
448 | |||
449 | $ chmod +x a/a |
|
449 | $ chmod +x a/a | |
450 | $ hg shelve -q -n execbit a/a |
|
450 | $ hg shelve -q -n execbit a/a | |
451 | $ hg status a/a |
|
451 | $ hg status a/a | |
452 | $ hg unshelve -q execbit |
|
452 | $ hg unshelve -q execbit | |
453 | $ hg status a/a |
|
453 | $ hg status a/a | |
454 | M a/a |
|
454 | M a/a | |
455 | $ hg revert a/a |
|
455 | $ hg revert a/a | |
456 |
|
456 | |||
457 | #endif |
|
457 | #endif | |
458 |
|
458 | |||
459 | #if symlink |
|
459 | #if symlink | |
460 |
|
460 | |||
461 | $ rm a/a |
|
461 | $ rm a/a | |
462 | $ ln -s foo a/a |
|
462 | $ ln -s foo a/a | |
463 | $ hg shelve -q -n symlink a/a |
|
463 | $ hg shelve -q -n symlink a/a | |
464 | $ hg status a/a |
|
464 | $ hg status a/a | |
465 | $ hg unshelve -q symlink |
|
465 | $ hg unshelve -q symlink | |
466 | $ hg status a/a |
|
466 | $ hg status a/a | |
467 | M a/a |
|
467 | M a/a | |
468 | $ hg revert a/a |
|
468 | $ hg revert a/a | |
469 |
|
469 | |||
470 | #endif |
|
470 | #endif | |
471 |
|
471 | |||
472 | set up another conflict between a commit and a shelved change |
|
472 | set up another conflict between a commit and a shelved change | |
473 |
|
473 | |||
474 | $ hg revert -q -C -a |
|
474 | $ hg revert -q -C -a | |
475 | $ rm a/a.orig b.rename/b c.copy |
|
475 | $ rm a/a.orig b.rename/b c.copy | |
476 | $ echo a >> a/a |
|
476 | $ echo a >> a/a | |
477 | $ hg shelve -q |
|
477 | $ hg shelve -q | |
478 | $ echo x >> a/a |
|
478 | $ echo x >> a/a | |
479 | $ hg ci -m 'create conflict' |
|
479 | $ hg ci -m 'create conflict' | |
480 | $ hg add foo/foo |
|
480 | $ hg add foo/foo | |
481 |
|
481 | |||
482 | if we resolve a conflict while unshelving, the unshelve should succeed |
|
482 | if we resolve a conflict while unshelving, the unshelve should succeed | |
483 |
|
483 | |||
484 | $ hg unshelve --tool :merge-other --keep |
|
484 | $ hg unshelve --tool :merge-other --keep | |
485 | unshelving change 'default' |
|
485 | unshelving change 'default' | |
486 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
486 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
487 | rebasing shelved changes |
|
487 | rebasing shelved changes | |
488 | rebasing 6:2f694dd83a13 "changes to: second" (tip) |
|
488 | rebasing 6:2f694dd83a13 "changes to: second" (tip) | |
489 | merging a/a |
|
489 | merging a/a | |
490 | $ hg parents -q |
|
490 | $ hg parents -q | |
491 | 4:33f7f61e6c5e |
|
491 | 4:33f7f61e6c5e | |
492 | $ hg shelve -l |
|
492 | $ hg shelve -l | |
493 | default (*)* changes to: second (glob) |
|
493 | default (*)* changes to: second (glob) | |
494 | $ hg status |
|
494 | $ hg status | |
495 | M a/a |
|
495 | M a/a | |
496 | A foo/foo |
|
496 | A foo/foo | |
497 | $ cat a/a |
|
497 | $ cat a/a | |
498 | a |
|
498 | a | |
499 | c |
|
499 | c | |
500 | a |
|
500 | a | |
501 | $ cat > a/a << EOF |
|
501 | $ cat > a/a << EOF | |
502 | > a |
|
502 | > a | |
503 | > c |
|
503 | > c | |
504 | > x |
|
504 | > x | |
505 | > EOF |
|
505 | > EOF | |
506 |
|
506 | |||
507 | $ HGMERGE=true hg unshelve |
|
507 | $ HGMERGE=true hg unshelve | |
508 | unshelving change 'default' |
|
508 | unshelving change 'default' | |
509 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
509 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
510 | rebasing shelved changes |
|
510 | rebasing shelved changes | |
511 | rebasing 6:2f694dd83a13 "changes to: second" (tip) |
|
511 | rebasing 6:2f694dd83a13 "changes to: second" (tip) | |
512 | merging a/a |
|
512 | merging a/a | |
513 | note: rebase of 6:2f694dd83a13 created no changes to commit |
|
513 | note: rebase of 6:2f694dd83a13 created no changes to commit | |
514 | $ hg parents -q |
|
514 | $ hg parents -q | |
515 | 4:33f7f61e6c5e |
|
515 | 4:33f7f61e6c5e | |
516 | $ hg shelve -l |
|
516 | $ hg shelve -l | |
517 | $ hg status |
|
517 | $ hg status | |
518 | A foo/foo |
|
518 | A foo/foo | |
519 | $ cat a/a |
|
519 | $ cat a/a | |
520 | a |
|
520 | a | |
521 | c |
|
521 | c | |
522 | x |
|
522 | x | |
523 |
|
523 | |||
524 | test keep and cleanup |
|
524 | test keep and cleanup | |
525 |
|
525 | |||
526 | $ hg shelve |
|
526 | $ hg shelve | |
527 | shelved as default |
|
527 | shelved as default | |
528 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
528 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
529 | $ hg shelve --list |
|
529 | $ hg shelve --list | |
530 | default (*)* changes to: create conflict (glob) |
|
530 | default (*)* changes to: create conflict (glob) | |
531 | $ hg unshelve -k |
|
531 | $ hg unshelve -k | |
532 | unshelving change 'default' |
|
532 | unshelving change 'default' | |
533 | $ hg shelve --list |
|
533 | $ hg shelve --list | |
534 | default (*)* changes to: create conflict (glob) |
|
534 | default (*)* changes to: create conflict (glob) | |
535 | $ hg shelve --cleanup |
|
535 | $ hg shelve --cleanup | |
536 | $ hg shelve --list |
|
536 | $ hg shelve --list | |
537 |
|
537 | |||
538 | $ hg shelve --cleanup --delete |
|
538 | $ hg shelve --cleanup --delete | |
539 | abort: options '--cleanup' and '--delete' may not be used together |
|
539 | abort: options '--cleanup' and '--delete' may not be used together | |
540 | [255] |
|
540 | [255] | |
541 | $ hg shelve --cleanup --patch |
|
541 | $ hg shelve --cleanup --patch | |
542 | abort: options '--cleanup' and '--patch' may not be used together |
|
542 | abort: options '--cleanup' and '--patch' may not be used together | |
543 | [255] |
|
543 | [255] | |
544 | $ hg shelve --cleanup --message MESSAGE |
|
544 | $ hg shelve --cleanup --message MESSAGE | |
545 | abort: options '--cleanup' and '--message' may not be used together |
|
545 | abort: options '--cleanup' and '--message' may not be used together | |
546 | [255] |
|
546 | [255] | |
547 |
|
547 | |||
548 | test bookmarks |
|
548 | test bookmarks | |
549 |
|
549 | |||
550 | $ hg bookmark test |
|
550 | $ hg bookmark test | |
551 | $ hg bookmark |
|
551 | $ hg bookmark | |
552 | * test 4:33f7f61e6c5e |
|
552 | * test 4:33f7f61e6c5e | |
553 | $ hg shelve |
|
553 | $ hg shelve | |
554 | shelved as test |
|
554 | shelved as test | |
555 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
555 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
556 | $ hg bookmark |
|
556 | $ hg bookmark | |
557 | * test 4:33f7f61e6c5e |
|
557 | * test 4:33f7f61e6c5e | |
558 | $ hg unshelve |
|
558 | $ hg unshelve | |
559 | unshelving change 'test' |
|
559 | unshelving change 'test' | |
560 | $ hg bookmark |
|
560 | $ hg bookmark | |
561 | * test 4:33f7f61e6c5e |
|
561 | * test 4:33f7f61e6c5e | |
562 |
|
562 | |||
563 | shelve should still work even if mq is disabled |
|
563 | shelve should still work even if mq is disabled | |
564 |
|
564 | |||
565 | $ hg --config extensions.mq=! shelve |
|
565 | $ hg --config extensions.mq=! shelve | |
566 | shelved as test |
|
566 | shelved as test | |
567 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
567 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
568 | $ hg --config extensions.mq=! shelve --list |
|
568 | $ hg --config extensions.mq=! shelve --list | |
569 | test (*)* changes to: create conflict (glob) |
|
569 | test (*)* changes to: create conflict (glob) | |
570 | $ hg bookmark |
|
570 | $ hg bookmark | |
571 | * test 4:33f7f61e6c5e |
|
571 | * test 4:33f7f61e6c5e | |
572 | $ hg --config extensions.mq=! unshelve |
|
572 | $ hg --config extensions.mq=! unshelve | |
573 | unshelving change 'test' |
|
573 | unshelving change 'test' | |
574 | $ hg bookmark |
|
574 | $ hg bookmark | |
575 | * test 4:33f7f61e6c5e |
|
575 | * test 4:33f7f61e6c5e | |
576 |
|
576 | |||
577 | shelve should leave dirstate clean (issue4055) |
|
577 | shelve should leave dirstate clean (issue4055) | |
578 |
|
578 | |||
579 | $ cd .. |
|
579 | $ cd .. | |
580 | $ hg init shelverebase |
|
580 | $ hg init shelverebase | |
581 | $ cd shelverebase |
|
581 | $ cd shelverebase | |
582 | $ printf 'x\ny\n' > x |
|
582 | $ printf 'x\ny\n' > x | |
583 | $ echo z > z |
|
583 | $ echo z > z | |
584 | $ hg commit -Aqm xy |
|
584 | $ hg commit -Aqm xy | |
585 | $ echo z >> x |
|
585 | $ echo z >> x | |
586 | $ hg commit -Aqm z |
|
586 | $ hg commit -Aqm z | |
587 | $ hg up 0 |
|
587 | $ hg up 0 | |
588 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
588 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
589 | $ printf 'a\nx\ny\nz\n' > x |
|
589 | $ printf 'a\nx\ny\nz\n' > x | |
590 | $ hg commit -Aqm xyz |
|
590 | $ hg commit -Aqm xyz | |
591 | $ echo c >> z |
|
591 | $ echo c >> z | |
592 | $ hg shelve |
|
592 | $ hg shelve | |
593 | shelved as default |
|
593 | shelved as default | |
594 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
594 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
595 | $ hg rebase -d 1 --config extensions.rebase= |
|
595 | $ hg rebase -d 1 --config extensions.rebase= | |
596 | rebasing 2:323bfa07f744 "xyz" (tip) |
|
596 | rebasing 2:323bfa07f744 "xyz" (tip) | |
597 | merging x |
|
597 | merging x | |
598 | saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-backup.hg (glob) |
|
598 | saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-backup.hg (glob) | |
599 | $ hg unshelve |
|
599 | $ hg unshelve | |
600 | unshelving change 'default' |
|
600 | unshelving change 'default' | |
601 | rebasing shelved changes |
|
601 | rebasing shelved changes | |
602 | rebasing 4:82a0d7d6ba61 "changes to: xyz" (tip) |
|
602 | rebasing 4:82a0d7d6ba61 "changes to: xyz" (tip) | |
603 | $ hg status |
|
603 | $ hg status | |
604 | M z |
|
604 | M z | |
605 |
|
605 | |||
606 | $ cd .. |
|
606 | $ cd .. | |
607 |
|
607 | |||
608 | shelve should only unshelve pending changes (issue4068) |
|
608 | shelve should only unshelve pending changes (issue4068) | |
609 |
|
609 | |||
610 | $ hg init onlypendingchanges |
|
610 | $ hg init onlypendingchanges | |
611 | $ cd onlypendingchanges |
|
611 | $ cd onlypendingchanges | |
612 | $ touch a |
|
612 | $ touch a | |
613 | $ hg ci -Aqm a |
|
613 | $ hg ci -Aqm a | |
614 | $ touch b |
|
614 | $ touch b | |
615 | $ hg ci -Aqm b |
|
615 | $ hg ci -Aqm b | |
616 | $ hg up -q 0 |
|
616 | $ hg up -q 0 | |
617 | $ touch c |
|
617 | $ touch c | |
618 | $ hg ci -Aqm c |
|
618 | $ hg ci -Aqm c | |
619 |
|
619 | |||
620 | $ touch d |
|
620 | $ touch d | |
621 | $ hg add d |
|
621 | $ hg add d | |
622 | $ hg shelve |
|
622 | $ hg shelve | |
623 | shelved as default |
|
623 | shelved as default | |
624 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
624 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
625 | $ hg up -q 1 |
|
625 | $ hg up -q 1 | |
626 | $ hg unshelve |
|
626 | $ hg unshelve | |
627 | unshelving change 'default' |
|
627 | unshelving change 'default' | |
628 | rebasing shelved changes |
|
628 | rebasing shelved changes | |
629 | rebasing 3:958bcbd1776e "changes to: c" (tip) |
|
629 | rebasing 3:958bcbd1776e "changes to: c" (tip) | |
630 | $ hg status |
|
630 | $ hg status | |
631 | A d |
|
631 | A d | |
632 |
|
632 | |||
633 | unshelve should work on an ancestor of the original commit |
|
633 | unshelve should work on an ancestor of the original commit | |
634 |
|
634 | |||
635 | $ hg shelve |
|
635 | $ hg shelve | |
636 | shelved as default |
|
636 | shelved as default | |
637 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
637 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
638 | $ hg up 0 |
|
638 | $ hg up 0 | |
639 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
639 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
640 | $ hg unshelve |
|
640 | $ hg unshelve | |
641 | unshelving change 'default' |
|
641 | unshelving change 'default' | |
642 | rebasing shelved changes |
|
642 | rebasing shelved changes | |
643 | rebasing 3:013284d9655e "changes to: b" (tip) |
|
643 | rebasing 3:013284d9655e "changes to: b" (tip) | |
644 | $ hg status |
|
644 | $ hg status | |
645 | A d |
|
645 | A d | |
646 |
|
646 | |||
647 | test bug 4073 we need to enable obsolete markers for it |
|
647 | test bug 4073 we need to enable obsolete markers for it | |
648 |
|
648 | |||
649 | $ cat >> $HGRCPATH << EOF |
|
649 | $ cat >> $HGRCPATH << EOF | |
650 | > [experimental] |
|
650 | > [experimental] | |
651 | > evolution=createmarkers |
|
651 | > evolution=createmarkers | |
652 | > EOF |
|
652 | > EOF | |
653 | $ hg shelve |
|
653 | $ hg shelve | |
654 | shelved as default |
|
654 | shelved as default | |
655 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
655 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
656 | $ hg debugobsolete `hg --debug id -i -r 1` |
|
656 | $ hg debugobsolete `hg --debug id -i -r 1` | |
657 | $ hg unshelve |
|
657 | $ hg unshelve | |
658 | unshelving change 'default' |
|
658 | unshelving change 'default' | |
659 |
|
659 | |||
660 | unshelve should leave unknown files alone (issue4113) |
|
660 | unshelve should leave unknown files alone (issue4113) | |
661 |
|
661 | |||
662 | $ echo e > e |
|
662 | $ echo e > e | |
663 | $ hg shelve |
|
663 | $ hg shelve | |
664 | shelved as default |
|
664 | shelved as default | |
665 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
665 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
666 | $ hg status |
|
666 | $ hg status | |
667 | ? e |
|
667 | ? e | |
668 | $ hg unshelve |
|
668 | $ hg unshelve | |
669 | unshelving change 'default' |
|
669 | unshelving change 'default' | |
670 | $ hg status |
|
670 | $ hg status | |
671 | A d |
|
671 | A d | |
672 | ? e |
|
672 | ? e | |
673 | $ cat e |
|
673 | $ cat e | |
674 | e |
|
674 | e | |
675 |
|
675 | |||
676 | unshelve should keep a copy of unknown files |
|
676 | unshelve should keep a copy of unknown files | |
677 |
|
677 | |||
678 | $ hg add e |
|
678 | $ hg add e | |
679 | $ hg shelve |
|
679 | $ hg shelve | |
680 | shelved as default |
|
680 | shelved as default | |
681 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
681 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
682 | $ echo z > e |
|
682 | $ echo z > e | |
683 | $ hg unshelve |
|
683 | $ hg unshelve | |
684 | unshelving change 'default' |
|
684 | unshelving change 'default' | |
685 | $ cat e |
|
685 | $ cat e | |
686 | e |
|
686 | e | |
687 | $ cat e.orig |
|
687 | $ cat e.orig | |
688 | z |
|
688 | z | |
689 |
|
689 | |||
690 |
|
690 | |||
691 | unshelve and conflicts with tracked and untracked files |
|
691 | unshelve and conflicts with tracked and untracked files | |
692 |
|
692 | |||
693 | preparing: |
|
693 | preparing: | |
694 |
|
694 | |||
695 | $ rm *.orig |
|
695 | $ rm *.orig | |
696 | $ hg ci -qm 'commit stuff' |
|
696 | $ hg ci -qm 'commit stuff' | |
697 | $ hg phase -p null: |
|
697 | $ hg phase -p null: | |
698 |
|
698 | |||
699 | no other changes - no merge: |
|
699 | no other changes - no merge: | |
700 |
|
700 | |||
701 | $ echo f > f |
|
701 | $ echo f > f | |
702 | $ hg add f |
|
702 | $ hg add f | |
703 | $ hg shelve |
|
703 | $ hg shelve | |
704 | shelved as default |
|
704 | shelved as default | |
705 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
705 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
706 | $ echo g > f |
|
706 | $ echo g > f | |
707 | $ hg unshelve |
|
707 | $ hg unshelve | |
708 | unshelving change 'default' |
|
708 | unshelving change 'default' | |
709 | $ hg st |
|
709 | $ hg st | |
710 | A f |
|
710 | A f | |
711 | ? f.orig |
|
711 | ? f.orig | |
712 | $ cat f |
|
712 | $ cat f | |
713 | f |
|
713 | f | |
714 | $ cat f.orig |
|
714 | $ cat f.orig | |
715 | g |
|
715 | g | |
716 |
|
716 | |||
717 | other uncommitted changes - merge: |
|
717 | other uncommitted changes - merge: | |
718 |
|
718 | |||
719 | $ hg st |
|
719 | $ hg st | |
720 | A f |
|
720 | A f | |
721 | ? f.orig |
|
721 | ? f.orig | |
722 | $ hg shelve |
|
722 | $ hg shelve | |
723 | shelved as default |
|
723 | shelved as default | |
724 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
724 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
725 | $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' |
|
725 | $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' | |
726 | o 4 changes to: commit stuff shelve@localhost |
|
726 | o 4 changes to: commit stuff shelve@localhost | |
727 | | |
|
727 | | | |
728 | ~ |
|
728 | ~ | |
729 | $ hg log -G --template '{rev} {desc|firstline} {author}' |
|
729 | $ hg log -G --template '{rev} {desc|firstline} {author}' | |
730 | @ 3 commit stuff test |
|
730 | @ 3 commit stuff test | |
731 | | |
|
731 | | | |
732 | | o 2 c test |
|
732 | | o 2 c test | |
733 | |/ |
|
733 | |/ | |
734 | o 0 a test |
|
734 | o 0 a test | |
735 |
|
735 | |||
736 | $ mv f.orig f |
|
736 | $ mv f.orig f | |
737 | $ echo 1 > a |
|
737 | $ echo 1 > a | |
738 | $ hg unshelve --date '1073741824 0' |
|
738 | $ hg unshelve --date '1073741824 0' | |
739 | unshelving change 'default' |
|
739 | unshelving change 'default' | |
740 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
740 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
741 | rebasing shelved changes |
|
741 | rebasing shelved changes | |
742 | rebasing 5:81152db69da7 "changes to: commit stuff" (tip) |
|
742 | rebasing 5:81152db69da7 "changes to: commit stuff" (tip) | |
743 | merging f |
|
743 | merging f | |
744 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
744 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
745 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
745 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
746 | [1] |
|
746 | [1] | |
747 | $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}' |
|
747 | $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}' | |
748 | @ 5 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000 |
|
748 | @ 5 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000 | |
749 | | |
|
749 | | | |
750 | | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000 |
|
750 | | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000 | |
751 | |/ |
|
751 | |/ | |
752 | o 3 commit stuff test 1970-01-01 00:00 +0000 |
|
752 | o 3 commit stuff test 1970-01-01 00:00 +0000 | |
753 | | |
|
753 | | | |
754 | | o 2 c test 1970-01-01 00:00 +0000 |
|
754 | | o 2 c test 1970-01-01 00:00 +0000 | |
755 | |/ |
|
755 | |/ | |
756 | o 0 a test 1970-01-01 00:00 +0000 |
|
756 | o 0 a test 1970-01-01 00:00 +0000 | |
757 |
|
757 | |||
758 | $ hg st |
|
758 | $ hg st | |
759 | M f |
|
759 | M f | |
760 | ? f.orig |
|
760 | ? f.orig | |
761 | $ cat f |
|
761 | $ cat f | |
762 | <<<<<<< dest: 5f6b880e719b - shelve: pending changes temporary commit |
|
762 | <<<<<<< dest: 5f6b880e719b - shelve: pending changes temporary commit | |
763 | g |
|
763 | g | |
764 | ======= |
|
764 | ======= | |
765 | f |
|
765 | f | |
766 | >>>>>>> source: 81152db69da7 - shelve: changes to: commit stuff |
|
766 | >>>>>>> source: 81152db69da7 - shelve: changes to: commit stuff | |
767 | $ cat f.orig |
|
767 | $ cat f.orig | |
768 | g |
|
768 | g | |
769 | $ hg unshelve --abort -t false |
|
769 | $ hg unshelve --abort -t false | |
770 | tool option will be ignored |
|
770 | tool option will be ignored | |
771 | rebase aborted |
|
771 | rebase aborted | |
772 | unshelve of 'default' aborted |
|
772 | unshelve of 'default' aborted | |
773 | $ hg st |
|
773 | $ hg st | |
774 | M a |
|
774 | M a | |
775 | ? f.orig |
|
775 | ? f.orig | |
776 | $ cat f.orig |
|
776 | $ cat f.orig | |
777 | g |
|
777 | g | |
778 | $ hg unshelve |
|
778 | $ hg unshelve | |
779 | unshelving change 'default' |
|
779 | unshelving change 'default' | |
780 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
780 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
781 | rebasing shelved changes |
|
781 | rebasing shelved changes | |
782 | rebasing 5:81152db69da7 "changes to: commit stuff" (tip) |
|
782 | rebasing 5:81152db69da7 "changes to: commit stuff" (tip) | |
783 | $ hg st |
|
783 | $ hg st | |
784 | M a |
|
784 | M a | |
785 | A f |
|
785 | A f | |
786 | ? f.orig |
|
786 | ? f.orig | |
787 |
|
787 | |||
788 | other committed changes - merge: |
|
788 | other committed changes - merge: | |
789 |
|
789 | |||
790 | $ hg shelve f |
|
790 | $ hg shelve f | |
791 | shelved as default |
|
791 | shelved as default | |
792 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
792 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
793 | $ hg ci a -m 'intermediate other change' |
|
793 | $ hg ci a -m 'intermediate other change' | |
794 | $ mv f.orig f |
|
794 | $ mv f.orig f | |
795 | $ hg unshelve |
|
795 | $ hg unshelve | |
796 | unshelving change 'default' |
|
796 | unshelving change 'default' | |
797 | rebasing shelved changes |
|
797 | rebasing shelved changes | |
798 | rebasing 5:81152db69da7 "changes to: commit stuff" (tip) |
|
798 | rebasing 5:81152db69da7 "changes to: commit stuff" (tip) | |
799 | merging f |
|
799 | merging f | |
800 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
800 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
801 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
801 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
802 | [1] |
|
802 | [1] | |
803 | $ hg st |
|
803 | $ hg st | |
804 | M f |
|
804 | M f | |
805 | ? f.orig |
|
805 | ? f.orig | |
806 | $ cat f |
|
806 | $ cat f | |
807 | <<<<<<< dest: * - test: intermediate other change (glob) |
|
807 | <<<<<<< dest: * - test: intermediate other change (glob) | |
808 | g |
|
808 | g | |
809 | ======= |
|
809 | ======= | |
810 | f |
|
810 | f | |
811 | >>>>>>> source: 81152db69da7 - shelve: changes to: commit stuff |
|
811 | >>>>>>> source: 81152db69da7 - shelve: changes to: commit stuff | |
812 | $ cat f.orig |
|
812 | $ cat f.orig | |
813 | g |
|
813 | g | |
814 | $ hg unshelve --abort |
|
814 | $ hg unshelve --abort | |
815 | rebase aborted |
|
815 | rebase aborted | |
816 | unshelve of 'default' aborted |
|
816 | unshelve of 'default' aborted | |
817 | $ hg st |
|
817 | $ hg st | |
818 | ? f.orig |
|
818 | ? f.orig | |
819 | $ cat f.orig |
|
819 | $ cat f.orig | |
820 | g |
|
820 | g | |
821 | $ hg shelve --delete default |
|
821 | $ hg shelve --delete default | |
822 |
|
822 | |||
823 | Recreate some conflict again |
|
823 | Recreate some conflict again | |
824 |
|
824 | |||
825 | $ cd ../repo |
|
825 | $ cd ../repo | |
826 | $ hg up -C -r 3 |
|
826 | $ hg up -C -r 3 | |
827 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
827 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
828 | (leaving bookmark test) |
|
828 | (leaving bookmark test) | |
829 | $ echo y >> a/a |
|
829 | $ echo y >> a/a | |
830 | $ hg shelve |
|
830 | $ hg shelve | |
831 | shelved as default |
|
831 | shelved as default | |
832 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
832 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
833 | $ hg up test |
|
833 | $ hg up test | |
834 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
834 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
835 | (activating bookmark test) |
|
835 | (activating bookmark test) | |
836 | $ hg bookmark |
|
836 | $ hg bookmark | |
837 | * test 4:33f7f61e6c5e |
|
837 | * test 4:33f7f61e6c5e | |
838 | $ hg unshelve |
|
838 | $ hg unshelve | |
839 | unshelving change 'default' |
|
839 | unshelving change 'default' | |
840 | rebasing shelved changes |
|
840 | rebasing shelved changes | |
841 | rebasing 5:e42a7da90865 "changes to: second" (tip) |
|
841 | rebasing 5:e42a7da90865 "changes to: second" (tip) | |
842 | merging a/a |
|
842 | merging a/a | |
843 | warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') |
|
843 | warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') | |
844 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
844 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
845 | [1] |
|
845 | [1] | |
846 | $ hg bookmark |
|
846 | $ hg bookmark | |
847 | test 4:33f7f61e6c5e |
|
847 | test 4:33f7f61e6c5e | |
848 |
|
848 | |||
849 | Test that resolving all conflicts in one direction (so that the rebase |
|
849 | Test that resolving all conflicts in one direction (so that the rebase | |
850 | is a no-op), works (issue4398) |
|
850 | is a no-op), works (issue4398) | |
851 |
|
851 | |||
852 | $ hg revert -a -r . |
|
852 | $ hg revert -a -r . | |
853 | reverting a/a (glob) |
|
853 | reverting a/a (glob) | |
854 | $ hg resolve -m a/a |
|
854 | $ hg resolve -m a/a | |
855 | (no more unresolved files) |
|
855 | (no more unresolved files) | |
856 | continue: hg unshelve --continue |
|
856 | continue: hg unshelve --continue | |
857 | $ hg unshelve -c |
|
857 | $ hg unshelve -c | |
858 | rebasing 5:e42a7da90865 "changes to: second" (tip) |
|
858 | rebasing 5:e42a7da90865 "changes to: second" (tip) | |
859 | note: rebase of 5:e42a7da90865 created no changes to commit |
|
859 | note: rebase of 5:e42a7da90865 created no changes to commit | |
860 | unshelve of 'default' complete |
|
860 | unshelve of 'default' complete | |
861 | $ hg bookmark |
|
861 | $ hg bookmark | |
862 | * test 4:33f7f61e6c5e |
|
862 | * test 4:33f7f61e6c5e | |
863 | $ hg diff |
|
863 | $ hg diff | |
864 | $ hg status |
|
864 | $ hg status | |
865 | ? a/a.orig |
|
865 | ? a/a.orig | |
866 | ? foo/foo |
|
866 | ? foo/foo | |
867 | $ hg summary |
|
867 | $ hg summary | |
868 | parent: 4:33f7f61e6c5e tip |
|
868 | parent: 4:33f7f61e6c5e tip | |
869 | create conflict |
|
869 | create conflict | |
870 | branch: default |
|
870 | branch: default | |
871 | bookmarks: *test |
|
871 | bookmarks: *test | |
872 | commit: 2 unknown (clean) |
|
872 | commit: 2 unknown (clean) | |
873 | update: (current) |
|
873 | update: (current) | |
874 | phases: 5 draft |
|
874 | phases: 5 draft | |
875 |
|
875 | |||
876 | $ hg shelve --delete --stat |
|
876 | $ hg shelve --delete --stat | |
877 | abort: options '--delete' and '--stat' may not be used together |
|
877 | abort: options '--delete' and '--stat' may not be used together | |
878 | [255] |
|
878 | [255] | |
879 | $ hg shelve --delete --name NAME |
|
879 | $ hg shelve --delete --name NAME | |
880 | abort: options '--delete' and '--name' may not be used together |
|
880 | abort: options '--delete' and '--name' may not be used together | |
881 | [255] |
|
881 | [255] | |
882 |
|
882 | |||
883 | Test interactive shelve |
|
883 | Test interactive shelve | |
884 | $ cat <<EOF >> $HGRCPATH |
|
884 | $ cat <<EOF >> $HGRCPATH | |
885 | > [ui] |
|
885 | > [ui] | |
886 | > interactive = true |
|
886 | > interactive = true | |
887 | > EOF |
|
887 | > EOF | |
888 | $ echo 'a' >> a/b |
|
888 | $ echo 'a' >> a/b | |
889 | $ cat a/a >> a/b |
|
889 | $ cat a/a >> a/b | |
890 | $ echo 'x' >> a/b |
|
890 | $ echo 'x' >> a/b | |
891 | $ mv a/b a/a |
|
891 | $ mv a/b a/a | |
892 | $ echo 'a' >> foo/foo |
|
892 | $ echo 'a' >> foo/foo | |
893 | $ hg st |
|
893 | $ hg st | |
894 | M a/a |
|
894 | M a/a | |
895 | ? a/a.orig |
|
895 | ? a/a.orig | |
896 | ? foo/foo |
|
896 | ? foo/foo | |
897 | $ cat a/a |
|
897 | $ cat a/a | |
898 | a |
|
898 | a | |
899 | a |
|
899 | a | |
900 | c |
|
900 | c | |
901 | x |
|
901 | x | |
902 | x |
|
902 | x | |
903 | $ cat foo/foo |
|
903 | $ cat foo/foo | |
904 | foo |
|
904 | foo | |
905 | a |
|
905 | a | |
906 | $ hg shelve --interactive --config ui.interactive=false |
|
906 | $ hg shelve --interactive --config ui.interactive=false | |
907 | abort: running non-interactively |
|
907 | abort: running non-interactively | |
908 | [255] |
|
908 | [255] | |
909 | $ hg shelve --interactive << EOF |
|
909 | $ hg shelve --interactive << EOF | |
910 | > y |
|
910 | > y | |
911 | > y |
|
911 | > y | |
912 | > n |
|
912 | > n | |
913 | > EOF |
|
913 | > EOF | |
914 | diff --git a/a/a b/a/a |
|
914 | diff --git a/a/a b/a/a | |
915 | 2 hunks, 2 lines changed |
|
915 | 2 hunks, 2 lines changed | |
916 | examine changes to 'a/a'? [Ynesfdaq?] y |
|
916 | examine changes to 'a/a'? [Ynesfdaq?] y | |
917 |
|
917 | |||
918 | @@ -1,3 +1,4 @@ |
|
918 | @@ -1,3 +1,4 @@ | |
919 | +a |
|
919 | +a | |
920 | a |
|
920 | a | |
921 | c |
|
921 | c | |
922 | x |
|
922 | x | |
923 | record change 1/2 to 'a/a'? [Ynesfdaq?] y |
|
923 | record change 1/2 to 'a/a'? [Ynesfdaq?] y | |
924 |
|
924 | |||
925 | @@ -1,3 +2,4 @@ |
|
925 | @@ -1,3 +2,4 @@ | |
926 | a |
|
926 | a | |
927 | c |
|
927 | c | |
928 | x |
|
928 | x | |
929 | +x |
|
929 | +x | |
930 | record change 2/2 to 'a/a'? [Ynesfdaq?] n |
|
930 | record change 2/2 to 'a/a'? [Ynesfdaq?] n | |
931 |
|
931 | |||
932 | shelved as test |
|
932 | shelved as test | |
933 | merging a/a |
|
933 | merging a/a | |
934 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
934 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
935 | $ cat a/a |
|
935 | $ cat a/a | |
936 | a |
|
936 | a | |
937 | c |
|
937 | c | |
938 | x |
|
938 | x | |
939 | x |
|
939 | x | |
940 | $ cat foo/foo |
|
940 | $ cat foo/foo | |
941 | foo |
|
941 | foo | |
942 | a |
|
942 | a | |
943 | $ hg st |
|
943 | $ hg st | |
944 | M a/a |
|
944 | M a/a | |
945 | ? foo/foo |
|
945 | ? foo/foo | |
946 | $ hg bookmark |
|
946 | $ hg bookmark | |
947 | * test 4:33f7f61e6c5e |
|
947 | * test 4:33f7f61e6c5e | |
948 | $ hg unshelve |
|
948 | $ hg unshelve | |
949 | unshelving change 'test' |
|
949 | unshelving change 'test' | |
950 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
950 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
951 | rebasing shelved changes |
|
951 | rebasing shelved changes | |
952 | rebasing 6:96a1354f65f6 "changes to: create conflict" (tip) |
|
952 | rebasing 6:96a1354f65f6 "changes to: create conflict" (tip) | |
953 | merging a/a |
|
953 | merging a/a | |
954 | $ hg bookmark |
|
954 | $ hg bookmark | |
955 | * test 4:33f7f61e6c5e |
|
955 | * test 4:33f7f61e6c5e | |
956 | $ cat a/a |
|
956 | $ cat a/a | |
957 | a |
|
957 | a | |
958 | a |
|
958 | a | |
959 | c |
|
959 | c | |
960 | x |
|
960 | x | |
961 | x |
|
961 | x | |
962 |
|
962 | |||
963 | shelve --patch and shelve --stat should work with a single valid shelfname |
|
963 | shelve --patch and shelve --stat should work with a single valid shelfname | |
964 |
|
964 | |||
965 | $ hg up --clean . |
|
965 | $ hg up --clean . | |
966 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
966 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
967 | (leaving bookmark test) |
|
967 | (leaving bookmark test) | |
968 | $ hg shelve --list |
|
968 | $ hg shelve --list | |
969 | $ echo 'patch a' > shelf-patch-a |
|
969 | $ echo 'patch a' > shelf-patch-a | |
970 | $ hg add shelf-patch-a |
|
970 | $ hg add shelf-patch-a | |
971 | $ hg shelve |
|
971 | $ hg shelve | |
972 | shelved as default |
|
972 | shelved as default | |
973 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
973 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
974 | $ echo 'patch b' > shelf-patch-b |
|
974 | $ echo 'patch b' > shelf-patch-b | |
975 | $ hg add shelf-patch-b |
|
975 | $ hg add shelf-patch-b | |
976 | $ hg shelve |
|
976 | $ hg shelve | |
977 | shelved as default-01 |
|
977 | shelved as default-01 | |
978 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
978 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
979 | $ hg shelve --patch default default-01 |
|
979 | $ hg shelve --patch default default-01 | |
980 | abort: --patch expects a single shelf |
|
980 | abort: --patch expects a single shelf | |
981 | [255] |
|
981 | [255] | |
982 | $ hg shelve --stat default default-01 |
|
982 | $ hg shelve --stat default default-01 | |
983 | abort: --stat expects a single shelf |
|
983 | abort: --stat expects a single shelf | |
984 | [255] |
|
984 | [255] | |
985 | $ hg shelve --patch default |
|
985 | $ hg shelve --patch default | |
986 | default (*)* changes to: create conflict (glob) |
|
986 | default (*)* changes to: create conflict (glob) | |
987 |
|
987 | |||
988 | diff --git a/shelf-patch-a b/shelf-patch-a |
|
988 | diff --git a/shelf-patch-a b/shelf-patch-a | |
989 | new file mode 100644 |
|
989 | new file mode 100644 | |
990 | --- /dev/null |
|
990 | --- /dev/null | |
991 | +++ b/shelf-patch-a |
|
991 | +++ b/shelf-patch-a | |
992 | @@ -0,0 +1,1 @@ |
|
992 | @@ -0,0 +1,1 @@ | |
993 | +patch a |
|
993 | +patch a | |
994 | $ hg shelve --stat default |
|
994 | $ hg shelve --stat default | |
995 | default (*)* changes to: create conflict (glob) |
|
995 | default (*)* changes to: create conflict (glob) | |
996 | shelf-patch-a | 1 + |
|
996 | shelf-patch-a | 1 + | |
997 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
997 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
998 | $ hg shelve --patch nonexistentshelf |
|
998 | $ hg shelve --patch nonexistentshelf | |
999 | abort: cannot find shelf nonexistentshelf |
|
999 | abort: cannot find shelf nonexistentshelf | |
1000 | [255] |
|
1000 | [255] | |
1001 | $ hg shelve --stat nonexistentshelf |
|
1001 | $ hg shelve --stat nonexistentshelf | |
1002 | abort: cannot find shelf nonexistentshelf |
|
1002 | abort: cannot find shelf nonexistentshelf | |
1003 | [255] |
|
1003 | [255] | |
1004 |
|
1004 | |||
1005 | $ cd .. |
|
1005 | $ cd .. | |
1006 |
|
1006 | |||
1007 | Shelve from general delta repo uses bundle2 on disk |
|
1007 | Shelve from general delta repo uses bundle2 on disk | |
1008 | -------------------------------------------------- |
|
1008 | -------------------------------------------------- | |
1009 |
|
1009 | |||
1010 | no general delta |
|
1010 | no general delta | |
1011 |
|
1011 | |||
1012 | $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0 |
|
1012 | $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0 | |
1013 | requesting all changes |
|
1013 | requesting all changes | |
1014 | adding changesets |
|
1014 | adding changesets | |
1015 | adding manifests |
|
1015 | adding manifests | |
1016 | adding file changes |
|
1016 | adding file changes | |
1017 | added 5 changesets with 8 changes to 6 files |
|
1017 | added 5 changesets with 8 changes to 6 files | |
1018 | updating to branch default |
|
1018 | updating to branch default | |
1019 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1019 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1020 | $ cd bundle1 |
|
1020 | $ cd bundle1 | |
1021 | $ echo babar > jungle |
|
1021 | $ echo babar > jungle | |
1022 | $ hg add jungle |
|
1022 | $ hg add jungle | |
1023 | $ hg shelve |
|
1023 | $ hg shelve | |
1024 | shelved as default |
|
1024 | shelved as default | |
1025 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1025 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1026 | $ hg debugbundle .hg/shelved/*.hg |
|
1026 | $ hg debugbundle .hg/shelved/*.hg | |
1027 | 45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d |
|
1027 | 45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d | |
1028 | $ cd .. |
|
1028 | $ cd .. | |
1029 |
|
1029 | |||
1030 | with general delta |
|
1030 | with general delta | |
1031 |
|
1031 | |||
1032 | $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1 |
|
1032 | $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1 | |
1033 | requesting all changes |
|
1033 | requesting all changes | |
1034 | adding changesets |
|
1034 | adding changesets | |
1035 | adding manifests |
|
1035 | adding manifests | |
1036 | adding file changes |
|
1036 | adding file changes | |
1037 | added 5 changesets with 8 changes to 6 files |
|
1037 | added 5 changesets with 8 changes to 6 files | |
1038 | updating to branch default |
|
1038 | updating to branch default | |
1039 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1039 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1040 | $ cd bundle2 |
|
1040 | $ cd bundle2 | |
1041 | $ echo babar > jungle |
|
1041 | $ echo babar > jungle | |
1042 | $ hg add jungle |
|
1042 | $ hg add jungle | |
1043 | $ hg shelve |
|
1043 | $ hg shelve | |
1044 | shelved as default |
|
1044 | shelved as default | |
1045 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1045 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1046 | $ hg debugbundle .hg/shelved/*.hg |
|
1046 | $ hg debugbundle .hg/shelved/*.hg | |
1047 | Stream params: {'Compression': 'BZ'} |
|
1047 | Stream params: {'Compression': 'BZ'} | |
1048 | changegroup -- "{'version': '02'}" |
|
1048 | changegroup -- "{'version': '02'}" | |
1049 | 45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d |
|
1049 | 45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d | |
1050 | $ cd .. |
|
1050 | $ cd .. | |
1051 |
|
1051 | |||
1052 | Test visibility of in-memory changes inside transaction to external hook |
|
1052 | Test visibility of in-memory changes inside transaction to external hook | |
1053 | ------------------------------------------------------------------------ |
|
1053 | ------------------------------------------------------------------------ | |
1054 |
|
1054 | |||
1055 | $ cd repo |
|
1055 | $ cd repo | |
1056 |
|
1056 | |||
1057 | $ echo xxxx >> x |
|
1057 | $ echo xxxx >> x | |
1058 | $ hg commit -m "#5: changes to invoke rebase" |
|
1058 | $ hg commit -m "#5: changes to invoke rebase" | |
1059 |
|
1059 | |||
1060 | $ cat > $TESTTMP/checkvisibility.sh <<EOF |
|
1060 | $ cat > $TESTTMP/checkvisibility.sh <<EOF | |
1061 | > echo "==== \$1:" |
|
1061 | > echo "==== \$1:" | |
1062 | > hg parents --template "VISIBLE {rev}:{node|short}\n" |
|
1062 | > hg parents --template "VISIBLE {rev}:{node|short}\n" | |
1063 | > # test that pending changes are hidden |
|
1063 | > # test that pending changes are hidden | |
1064 | > unset HG_PENDING |
|
1064 | > unset HG_PENDING | |
1065 | > hg parents --template "ACTUAL {rev}:{node|short}\n" |
|
1065 | > hg parents --template "ACTUAL {rev}:{node|short}\n" | |
1066 | > echo "====" |
|
1066 | > echo "====" | |
1067 | > EOF |
|
1067 | > EOF | |
1068 |
|
1068 | |||
1069 | $ cat >> .hg/hgrc <<EOF |
|
1069 | $ cat >> .hg/hgrc <<EOF | |
1070 | > [defaults] |
|
1070 | > [defaults] | |
1071 | > # to fix hash id of temporary revisions |
|
1071 | > # to fix hash id of temporary revisions | |
1072 | > unshelve = --date '0 0' |
|
1072 | > unshelve = --date '0 0' | |
1073 | > EOF |
|
1073 | > EOF | |
1074 |
|
1074 | |||
1075 | "hg unshelve" at REV5 implies steps below: |
|
1075 | "hg unshelve" at REV5 implies steps below: | |
1076 |
|
1076 | |||
1077 | (1) commit changes in the working directory (REV6) |
|
1077 | (1) commit changes in the working directory (REV6) | |
1078 | (2) unbundle shelved revision (REV7) |
|
1078 | (2) unbundle shelved revision (REV7) | |
1079 | (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7) |
|
1079 | (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7) | |
1080 | (4) rebase: commit merged revision (REV8) |
|
1080 | (4) rebase: commit merged revision (REV8) | |
1081 | (5) rebase: update to REV6 (REV8 => REV6) |
|
1081 | (5) rebase: update to REV6 (REV8 => REV6) | |
1082 | (6) update to REV5 (REV6 => REV5) |
|
1082 | (6) update to REV5 (REV6 => REV5) | |
1083 | (7) abort transaction |
|
1083 | (7) abort transaction | |
1084 |
|
1084 | |||
1085 | == test visibility to external preupdate hook |
|
1085 | == test visibility to external preupdate hook | |
1086 |
|
1086 | |||
1087 | $ cat >> .hg/hgrc <<EOF |
|
1087 | $ cat >> .hg/hgrc <<EOF | |
1088 | > [hooks] |
|
1088 | > [hooks] | |
1089 | > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate |
|
1089 | > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate | |
1090 | > EOF |
|
1090 | > EOF | |
1091 |
|
1091 | |||
1092 | $ echo nnnn >> n |
|
1092 | $ echo nnnn >> n | |
1093 |
|
1093 | |||
1094 | $ sh $TESTTMP/checkvisibility.sh before-unshelving |
|
1094 | $ sh $TESTTMP/checkvisibility.sh before-unshelving | |
1095 | ==== before-unshelving: |
|
1095 | ==== before-unshelving: | |
1096 | VISIBLE 5:703117a2acfb |
|
1096 | VISIBLE 5:703117a2acfb | |
1097 | ACTUAL 5:703117a2acfb |
|
1097 | ACTUAL 5:703117a2acfb | |
1098 | ==== |
|
1098 | ==== | |
1099 |
|
1099 | |||
1100 | $ hg unshelve --keep default |
|
1100 | $ hg unshelve --keep default | |
1101 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
1101 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
1102 | rebasing shelved changes |
|
1102 | rebasing shelved changes | |
1103 | rebasing 7:206bf5d4f922 "changes to: create conflict" (tip) |
|
1103 | rebasing 7:206bf5d4f922 "changes to: create conflict" (tip) | |
1104 | ==== preupdate: |
|
1104 | ==== preupdate: | |
1105 | VISIBLE 6:66b86db80ee4 |
|
1105 | VISIBLE 6:66b86db80ee4 | |
1106 | ACTUAL 5:703117a2acfb |
|
1106 | ACTUAL 5:703117a2acfb | |
1107 | ==== |
|
1107 | ==== | |
1108 | ==== preupdate: |
|
1108 | ==== preupdate: | |
1109 | VISIBLE 8:a0e04704317e |
|
1109 | VISIBLE 8:a0e04704317e | |
1110 | ACTUAL 5:703117a2acfb |
|
1110 | ACTUAL 5:703117a2acfb | |
1111 | ==== |
|
1111 | ==== | |
1112 | ==== preupdate: |
|
1112 | ==== preupdate: | |
1113 | VISIBLE 6:66b86db80ee4 |
|
1113 | VISIBLE 6:66b86db80ee4 | |
1114 | ACTUAL 5:703117a2acfb |
|
1114 | ACTUAL 5:703117a2acfb | |
1115 | ==== |
|
1115 | ==== | |
1116 |
|
1116 | |||
1117 | $ cat >> .hg/hgrc <<EOF |
|
1117 | $ cat >> .hg/hgrc <<EOF | |
1118 | > [hooks] |
|
1118 | > [hooks] | |
1119 | > preupdate.visibility = |
|
1119 | > preupdate.visibility = | |
1120 | > EOF |
|
1120 | > EOF | |
1121 |
|
1121 | |||
1122 | $ sh $TESTTMP/checkvisibility.sh after-unshelving |
|
1122 | $ sh $TESTTMP/checkvisibility.sh after-unshelving | |
1123 | ==== after-unshelving: |
|
1123 | ==== after-unshelving: | |
1124 | VISIBLE 5:703117a2acfb |
|
1124 | VISIBLE 5:703117a2acfb | |
1125 | ACTUAL 5:703117a2acfb |
|
1125 | ACTUAL 5:703117a2acfb | |
1126 | ==== |
|
1126 | ==== | |
1127 |
|
1127 | |||
1128 | == test visibility to external update hook |
|
1128 | == test visibility to external update hook | |
1129 |
|
1129 | |||
1130 | $ hg update -q -C 5 |
|
1130 | $ hg update -q -C 5 | |
1131 |
|
1131 | |||
1132 | $ cat >> .hg/hgrc <<EOF |
|
1132 | $ cat >> .hg/hgrc <<EOF | |
1133 | > [hooks] |
|
1133 | > [hooks] | |
1134 | > update.visibility = sh $TESTTMP/checkvisibility.sh update |
|
1134 | > update.visibility = sh $TESTTMP/checkvisibility.sh update | |
1135 | > EOF |
|
1135 | > EOF | |
1136 |
|
1136 | |||
1137 | $ echo nnnn >> n |
|
1137 | $ echo nnnn >> n | |
1138 |
|
1138 | |||
1139 | $ sh $TESTTMP/checkvisibility.sh before-unshelving |
|
1139 | $ sh $TESTTMP/checkvisibility.sh before-unshelving | |
1140 | ==== before-unshelving: |
|
1140 | ==== before-unshelving: | |
1141 | VISIBLE 5:703117a2acfb |
|
1141 | VISIBLE 5:703117a2acfb | |
1142 | ACTUAL 5:703117a2acfb |
|
1142 | ACTUAL 5:703117a2acfb | |
1143 | ==== |
|
1143 | ==== | |
1144 |
|
1144 | |||
1145 | $ hg unshelve --keep default |
|
1145 | $ hg unshelve --keep default | |
1146 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
1146 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
1147 | rebasing shelved changes |
|
1147 | rebasing shelved changes | |
1148 | rebasing 7:206bf5d4f922 "changes to: create conflict" (tip) |
|
1148 | rebasing 7:206bf5d4f922 "changes to: create conflict" (tip) | |
1149 | ==== update: |
|
1149 | ==== update: | |
1150 | VISIBLE 6:66b86db80ee4 |
|
1150 | VISIBLE 6:66b86db80ee4 | |
1151 | VISIBLE 7:206bf5d4f922 |
|
1151 | VISIBLE 7:206bf5d4f922 | |
1152 | ACTUAL 5:703117a2acfb |
|
1152 | ACTUAL 5:703117a2acfb | |
1153 | ==== |
|
1153 | ==== | |
1154 | ==== update: |
|
1154 | ==== update: | |
1155 | VISIBLE 6:66b86db80ee4 |
|
1155 | VISIBLE 6:66b86db80ee4 | |
1156 | ACTUAL 5:703117a2acfb |
|
1156 | ACTUAL 5:703117a2acfb | |
1157 | ==== |
|
1157 | ==== | |
1158 | ==== update: |
|
1158 | ==== update: | |
1159 | VISIBLE 5:703117a2acfb |
|
1159 | VISIBLE 5:703117a2acfb | |
1160 | ACTUAL 5:703117a2acfb |
|
1160 | ACTUAL 5:703117a2acfb | |
1161 | ==== |
|
1161 | ==== | |
1162 |
|
1162 | |||
1163 | $ cat >> .hg/hgrc <<EOF |
|
1163 | $ cat >> .hg/hgrc <<EOF | |
1164 | > [hooks] |
|
1164 | > [hooks] | |
1165 | > update.visibility = |
|
1165 | > update.visibility = | |
1166 | > EOF |
|
1166 | > EOF | |
1167 |
|
1167 | |||
1168 | $ sh $TESTTMP/checkvisibility.sh after-unshelving |
|
1168 | $ sh $TESTTMP/checkvisibility.sh after-unshelving | |
1169 | ==== after-unshelving: |
|
1169 | ==== after-unshelving: | |
1170 | VISIBLE 5:703117a2acfb |
|
1170 | VISIBLE 5:703117a2acfb | |
1171 | ACTUAL 5:703117a2acfb |
|
1171 | ACTUAL 5:703117a2acfb | |
1172 | ==== |
|
1172 | ==== | |
1173 |
|
1173 | |||
1174 | $ cd .. |
|
1174 | $ cd .. | |
1175 |
|
1175 | |||
1176 | test .orig files go where the user wants them to |
|
1176 | test .orig files go where the user wants them to | |
1177 | --------------------------------------------------------------- |
|
1177 | --------------------------------------------------------------- | |
1178 | $ hg init salvage |
|
1178 | $ hg init salvage | |
1179 | $ cd salvage |
|
1179 | $ cd salvage | |
1180 | $ echo 'content' > root |
|
1180 | $ echo 'content' > root | |
1181 | $ hg commit -A -m 'root' -q |
|
1181 | $ hg commit -A -m 'root' -q | |
1182 | $ echo '' > root |
|
1182 | $ echo '' > root | |
1183 | $ hg shelve -q |
|
1183 | $ hg shelve -q | |
1184 | $ echo 'contADDent' > root |
|
1184 | $ echo 'contADDent' > root | |
1185 | $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups' |
|
1185 | $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups' | |
1186 | warning: conflicts while merging root! (edit, then use 'hg resolve --mark') |
|
1186 | warning: conflicts while merging root! (edit, then use 'hg resolve --mark') | |
1187 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
1187 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
1188 | [1] |
|
1188 | [1] | |
1189 | $ ls .hg/origbackups |
|
1189 | $ ls .hg/origbackups | |
1190 | root.orig |
|
1190 | root.orig | |
1191 | $ rm -rf .hg/origbackups |
|
1191 | $ rm -rf .hg/origbackups | |
1192 |
|
1192 | |||
1193 | test Abort unshelve always gets user out of the unshelved state |
|
1193 | test Abort unshelve always gets user out of the unshelved state | |
1194 | --------------------------------------------------------------- |
|
1194 | --------------------------------------------------------------- | |
1195 | Wreak havoc on the unshelve process |
|
1195 | Wreak havoc on the unshelve process | |
1196 | $ rm .hg/unshelverebasestate |
|
1196 | $ rm .hg/unshelverebasestate | |
1197 | $ hg unshelve --abort |
|
1197 | $ hg unshelve --abort | |
1198 | unshelve of 'default' aborted |
|
1198 | unshelve of 'default' aborted | |
1199 | abort: (No such file or directory|The system cannot find the file specified) (re) |
|
1199 | abort: (No such file or directory|The system cannot find the file specified) (re) | |
1200 | [255] |
|
1200 | [255] | |
1201 | Can the user leave the current state? |
|
1201 | Can the user leave the current state? | |
1202 | $ hg up -C . |
|
1202 | $ hg up -C . | |
1203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1204 |
|
1204 | |||
1205 | Try again but with a corrupted shelve state file |
|
1205 | Try again but with a corrupted shelve state file | |
1206 | $ hg strip -r 2 -r 1 -q |
|
1206 | $ hg strip -r 2 -r 1 -q | |
1207 | $ hg up -r 0 -q |
|
1207 | $ hg up -r 0 -q | |
1208 | $ echo '' > root |
|
1208 | $ echo '' > root | |
1209 | $ hg shelve -q |
|
1209 | $ hg shelve -q | |
1210 | $ echo 'contADDent' > root |
|
1210 | $ echo 'contADDent' > root | |
1211 | $ hg unshelve -q |
|
1211 | $ hg unshelve -q | |
1212 | warning: conflicts while merging root! (edit, then use 'hg resolve --mark') |
|
1212 | warning: conflicts while merging root! (edit, then use 'hg resolve --mark') | |
1213 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
1213 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
1214 | [1] |
|
1214 | [1] | |
1215 | $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate |
|
1215 | $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate | |
1216 | $ mv ../corrupt-shelvedstate .hg/histedit-state |
|
1216 | $ mv ../corrupt-shelvedstate .hg/histedit-state | |
1217 | $ hg unshelve --abort 2>&1 | grep 'rebase aborted' |
|
1217 | $ hg unshelve --abort 2>&1 | grep 'rebase aborted' | |
1218 | rebase aborted |
|
1218 | rebase aborted | |
1219 | $ hg up -C . |
|
1219 | $ hg up -C . | |
1220 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1220 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1221 |
|
1221 | |||
1222 | $ cd .. |
|
1222 | $ cd .. | |
1223 |
|
1223 | |||
1224 | Keep active bookmark while (un)shelving even on shared repo (issue4940) |
|
1224 | Keep active bookmark while (un)shelving even on shared repo (issue4940) | |
1225 | ----------------------------------------------------------------------- |
|
1225 | ----------------------------------------------------------------------- | |
1226 |
|
1226 | |||
1227 | $ cat <<EOF >> $HGRCPATH |
|
1227 | $ cat <<EOF >> $HGRCPATH | |
1228 | > [extensions] |
|
1228 | > [extensions] | |
1229 | > share = |
|
1229 | > share = | |
1230 | > EOF |
|
1230 | > EOF | |
1231 |
|
1231 | |||
1232 | $ hg bookmarks -R repo |
|
1232 | $ hg bookmarks -R repo | |
1233 | test 4:33f7f61e6c5e |
|
1233 | test 4:33f7f61e6c5e | |
1234 | $ hg share -B repo share |
|
1234 | $ hg share -B repo share | |
1235 | updating working directory |
|
1235 | updating working directory | |
1236 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1236 | 6 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1237 | $ cd share |
|
1237 | $ cd share | |
1238 |
|
1238 | |||
1239 | $ hg bookmarks |
|
1239 | $ hg bookmarks | |
1240 | test 4:33f7f61e6c5e |
|
1240 | test 4:33f7f61e6c5e | |
1241 | $ hg bookmarks foo |
|
1241 | $ hg bookmarks foo | |
1242 | $ hg bookmarks |
|
1242 | $ hg bookmarks | |
1243 | * foo 5:703117a2acfb |
|
1243 | * foo 5:703117a2acfb | |
1244 | test 4:33f7f61e6c5e |
|
1244 | test 4:33f7f61e6c5e | |
1245 | $ echo x >> x |
|
1245 | $ echo x >> x | |
1246 | $ hg shelve |
|
1246 | $ hg shelve | |
1247 | shelved as foo |
|
1247 | shelved as foo | |
1248 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1248 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1249 | $ hg bookmarks |
|
1249 | $ hg bookmarks | |
1250 | * foo 5:703117a2acfb |
|
1250 | * foo 5:703117a2acfb | |
1251 | test 4:33f7f61e6c5e |
|
1251 | test 4:33f7f61e6c5e | |
1252 |
|
1252 | |||
1253 | $ hg unshelve |
|
1253 | $ hg unshelve | |
1254 | unshelving change 'foo' |
|
1254 | unshelving change 'foo' | |
1255 | $ hg bookmarks |
|
1255 | $ hg bookmarks | |
1256 | * foo 5:703117a2acfb |
|
1256 | * foo 5:703117a2acfb | |
1257 | test 4:33f7f61e6c5e |
|
1257 | test 4:33f7f61e6c5e | |
1258 |
|
1258 | |||
1259 | $ cd .. |
|
1259 | $ cd .. | |
1260 |
|
1260 | |||
1261 | Shelve and unshelve unknown files. For the purposes of unshelve, a shelved |
|
1261 | Shelve and unshelve unknown files. For the purposes of unshelve, a shelved | |
1262 | unknown file is the same as a shelved added file, except that it will be in |
|
1262 | unknown file is the same as a shelved added file, except that it will be in | |
1263 | unknown state after unshelve if and only if it was either absent or unknown |
|
1263 | unknown state after unshelve if and only if it was either absent or unknown | |
1264 | before the unshelve operation. |
|
1264 | before the unshelve operation. | |
1265 |
|
1265 | |||
1266 | $ hg init unknowns |
|
1266 | $ hg init unknowns | |
1267 | $ cd unknowns |
|
1267 | $ cd unknowns | |
1268 |
|
1268 | |||
1269 | The simplest case is if I simply have an unknown file that I shelve and unshelve |
|
1269 | The simplest case is if I simply have an unknown file that I shelve and unshelve | |
1270 |
|
1270 | |||
1271 | $ echo unknown > unknown |
|
1271 | $ echo unknown > unknown | |
1272 | $ hg status |
|
1272 | $ hg status | |
1273 | ? unknown |
|
1273 | ? unknown | |
1274 | $ hg shelve --unknown |
|
1274 | $ hg shelve --unknown | |
1275 | shelved as default |
|
1275 | shelved as default | |
1276 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1276 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1277 | $ hg status |
|
1277 | $ hg status | |
1278 | $ hg unshelve |
|
1278 | $ hg unshelve | |
1279 | unshelving change 'default' |
|
1279 | unshelving change 'default' | |
1280 | $ hg status |
|
1280 | $ hg status | |
1281 | ? unknown |
|
1281 | ? unknown | |
1282 | $ rm unknown |
|
1282 | $ rm unknown | |
1283 |
|
1283 | |||
1284 | If I shelve, add the file, and unshelve, does it stay added? |
|
1284 | If I shelve, add the file, and unshelve, does it stay added? | |
1285 |
|
1285 | |||
1286 | $ echo unknown > unknown |
|
1286 | $ echo unknown > unknown | |
1287 | $ hg shelve -u |
|
1287 | $ hg shelve -u | |
1288 | shelved as default |
|
1288 | shelved as default | |
1289 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1289 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1290 | $ hg status |
|
1290 | $ hg status | |
1291 | $ touch unknown |
|
1291 | $ touch unknown | |
1292 | $ hg add unknown |
|
1292 | $ hg add unknown | |
1293 | $ hg status |
|
1293 | $ hg status | |
1294 | A unknown |
|
1294 | A unknown | |
1295 | $ hg unshelve |
|
1295 | $ hg unshelve | |
1296 | unshelving change 'default' |
|
1296 | unshelving change 'default' | |
1297 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
1297 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
1298 | rebasing shelved changes |
|
1298 | rebasing shelved changes | |
1299 | rebasing 1:098df96e7410 "(changes in empty repository)" (tip) |
|
1299 | rebasing 1:098df96e7410 "(changes in empty repository)" (tip) | |
1300 | merging unknown |
|
1300 | merging unknown | |
1301 | $ hg status |
|
1301 | $ hg status | |
1302 | A unknown |
|
1302 | A unknown | |
1303 | $ hg forget unknown |
|
1303 | $ hg forget unknown | |
1304 | $ rm unknown |
|
1304 | $ rm unknown | |
1305 |
|
1305 | |||
1306 | And if I shelve, commit, then unshelve, does it become modified? |
|
1306 | And if I shelve, commit, then unshelve, does it become modified? | |
1307 |
|
1307 | |||
1308 | $ echo unknown > unknown |
|
1308 | $ echo unknown > unknown | |
1309 | $ hg shelve -u |
|
1309 | $ hg shelve -u | |
1310 | shelved as default |
|
1310 | shelved as default | |
1311 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1311 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1312 | $ hg status |
|
1312 | $ hg status | |
1313 | $ touch unknown |
|
1313 | $ touch unknown | |
1314 | $ hg add unknown |
|
1314 | $ hg add unknown | |
1315 | $ hg commit -qm "Add unknown" |
|
1315 | $ hg commit -qm "Add unknown" | |
1316 | $ hg status |
|
1316 | $ hg status | |
1317 | $ hg unshelve |
|
1317 | $ hg unshelve | |
1318 | unshelving change 'default' |
|
1318 | unshelving change 'default' | |
1319 | rebasing shelved changes |
|
1319 | rebasing shelved changes | |
1320 | rebasing 1:098df96e7410 "(changes in empty repository)" (tip) |
|
1320 | rebasing 1:098df96e7410 "(changes in empty repository)" (tip) | |
1321 | merging unknown |
|
1321 | merging unknown | |
1322 | $ hg status |
|
1322 | $ hg status | |
1323 | M unknown |
|
1323 | M unknown | |
1324 | $ hg remove --force unknown |
|
1324 | $ hg remove --force unknown | |
1325 | $ hg commit -qm "Remove unknown" |
|
1325 | $ hg commit -qm "Remove unknown" | |
1326 |
|
1326 | |||
1327 | $ cd .. |
|
1327 | $ cd .. | |
1328 |
|
1328 | |||
1329 | We expects that non-bare shelve keeps newly created branch in |
|
1329 | We expects that non-bare shelve keeps newly created branch in | |
1330 | working directory. |
|
1330 | working directory. | |
1331 |
|
1331 | |||
1332 | $ hg init shelve-preserve-new-branch |
|
1332 | $ hg init shelve-preserve-new-branch | |
1333 | $ cd shelve-preserve-new-branch |
|
1333 | $ cd shelve-preserve-new-branch | |
1334 | $ echo "a" >> a |
|
1334 | $ echo "a" >> a | |
1335 | $ hg add a |
|
1335 | $ hg add a | |
1336 | $ echo "b" >> b |
|
1336 | $ echo "b" >> b | |
1337 | $ hg add b |
|
1337 | $ hg add b | |
1338 | $ hg commit -m "ab" |
|
1338 | $ hg commit -m "ab" | |
1339 | $ echo "aa" >> a |
|
1339 | $ echo "aa" >> a | |
1340 | $ echo "bb" >> b |
|
1340 | $ echo "bb" >> b | |
1341 | $ hg branch new-branch |
|
1341 | $ hg branch new-branch | |
1342 | marked working directory as branch new-branch |
|
1342 | marked working directory as branch new-branch | |
1343 | (branches are permanent and global, did you want a bookmark?) |
|
1343 | (branches are permanent and global, did you want a bookmark?) | |
1344 | $ hg status |
|
1344 | $ hg status | |
1345 | M a |
|
1345 | M a | |
1346 | M b |
|
1346 | M b | |
1347 | $ hg branch |
|
1347 | $ hg branch | |
1348 | new-branch |
|
1348 | new-branch | |
1349 | $ hg shelve a |
|
1349 | $ hg shelve a | |
1350 | shelved as default |
|
1350 | shelved as default | |
1351 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1351 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1352 | $ hg branch |
|
1352 | $ hg branch | |
1353 | new-branch |
|
1353 | new-branch | |
1354 | $ hg status |
|
1354 | $ hg status | |
1355 | M b |
|
1355 | M b | |
1356 | $ touch "c" >> c |
|
1356 | $ touch "c" >> c | |
1357 | $ hg add c |
|
1357 | $ hg add c | |
1358 | $ hg status |
|
1358 | $ hg status | |
1359 | M b |
|
1359 | M b | |
1360 | A c |
|
1360 | A c | |
1361 | $ hg shelve --exclude c |
|
1361 | $ hg shelve --exclude c | |
1362 | shelved as default-01 |
|
1362 | shelved as default-01 | |
1363 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1363 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1364 | $ hg branch |
|
1364 | $ hg branch | |
1365 | new-branch |
|
1365 | new-branch | |
1366 | $ hg status |
|
1366 | $ hg status | |
1367 | A c |
|
1367 | A c | |
1368 | $ hg shelve --include c |
|
1368 | $ hg shelve --include c | |
1369 | shelved as default-02 |
|
1369 | shelved as default-02 | |
1370 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1370 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1371 | $ hg branch |
|
1371 | $ hg branch | |
1372 | new-branch |
|
1372 | new-branch | |
1373 | $ hg status |
|
1373 | $ hg status | |
1374 | $ echo "d" >> d |
|
1374 | $ echo "d" >> d | |
1375 | $ hg add d |
|
1375 | $ hg add d | |
1376 | $ hg status |
|
1376 | $ hg status | |
1377 | A d |
|
1377 | A d | |
1378 |
|
1378 | |||
1379 | We expect that bare-shelve will not keep branch in current working directory. |
|
1379 | We expect that bare-shelve will not keep branch in current working directory. | |
1380 |
|
1380 | |||
1381 | $ hg shelve |
|
1381 | $ hg shelve | |
1382 | shelved as default-03 |
|
1382 | shelved as default-03 | |
1383 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1383 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1384 | $ hg branch |
|
1384 | $ hg branch | |
1385 | default |
|
1385 | default | |
1386 |
|
1386 | |||
1387 | When i shelve commit on newly created branch i expect |
|
1387 | When i shelve commit on newly created branch i expect | |
1388 | that after unshelve newly created branch will be preserved. |
|
1388 | that after unshelve newly created branch will be preserved. | |
1389 |
|
1389 | |||
1390 | $ hg init shelve_on_new_branch_simple |
|
1390 | $ hg init shelve_on_new_branch_simple | |
1391 | $ cd shelve_on_new_branch_simple |
|
1391 | $ cd shelve_on_new_branch_simple | |
1392 | $ echo "aaa" >> a |
|
1392 | $ echo "aaa" >> a | |
1393 | $ hg commit -A -m "a" |
|
1393 | $ hg commit -A -m "a" | |
1394 | adding a |
|
1394 | adding a | |
1395 | $ hg branch |
|
1395 | $ hg branch | |
1396 | default |
|
1396 | default | |
1397 | $ hg branch test |
|
1397 | $ hg branch test | |
1398 | marked working directory as branch test |
|
1398 | marked working directory as branch test | |
1399 | (branches are permanent and global, did you want a bookmark?) |
|
1399 | (branches are permanent and global, did you want a bookmark?) | |
1400 | $ echo "bbb" >> a |
|
1400 | $ echo "bbb" >> a | |
1401 | $ hg status |
|
1401 | $ hg status | |
1402 | M a |
|
1402 | M a | |
1403 | $ hg shelve |
|
1403 | $ hg shelve | |
1404 | shelved as default |
|
1404 | shelved as default | |
1405 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1405 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1406 | $ hg branch |
|
1406 | $ hg branch | |
1407 | default |
|
1407 | default | |
1408 | $ echo "bbb" >> b |
|
1408 | $ echo "bbb" >> b | |
1409 | $ hg status |
|
1409 | $ hg status | |
1410 | ? b |
|
1410 | ? b | |
1411 | $ hg unshelve |
|
1411 | $ hg unshelve | |
1412 | unshelving change 'default' |
|
1412 | unshelving change 'default' | |
1413 | marked working directory as branch test |
|
1413 | marked working directory as branch test | |
1414 | $ hg status |
|
1414 | $ hg status | |
1415 | M a |
|
1415 | M a | |
1416 | ? b |
|
1416 | ? b | |
1417 | $ hg branch |
|
1417 | $ hg branch | |
1418 | test |
|
1418 | test | |
1419 |
|
1419 | |||
1420 | When i shelve commit on newly created branch, make |
|
1420 | When i shelve commit on newly created branch, make | |
1421 | some changes, unshelve it and running into merge |
|
1421 | some changes, unshelve it and running into merge | |
1422 | conflicts i expect that after fixing them and |
|
1422 | conflicts i expect that after fixing them and | |
1423 | running unshelve --continue newly created branch |
|
1423 | running unshelve --continue newly created branch | |
1424 | will be preserved. |
|
1424 | will be preserved. | |
1425 |
|
1425 | |||
1426 | $ hg init shelve_on_new_branch_conflict |
|
1426 | $ hg init shelve_on_new_branch_conflict | |
1427 | $ cd shelve_on_new_branch_conflict |
|
1427 | $ cd shelve_on_new_branch_conflict | |
1428 | $ echo "aaa" >> a |
|
1428 | $ echo "aaa" >> a | |
1429 | $ hg commit -A -m "a" |
|
1429 | $ hg commit -A -m "a" | |
1430 | adding a |
|
1430 | adding a | |
1431 | $ hg branch |
|
1431 | $ hg branch | |
1432 | default |
|
1432 | default | |
1433 | $ hg branch test |
|
1433 | $ hg branch test | |
1434 | marked working directory as branch test |
|
1434 | marked working directory as branch test | |
1435 | (branches are permanent and global, did you want a bookmark?) |
|
1435 | (branches are permanent and global, did you want a bookmark?) | |
1436 | $ echo "bbb" >> a |
|
1436 | $ echo "bbb" >> a | |
1437 | $ hg status |
|
1437 | $ hg status | |
1438 | M a |
|
1438 | M a | |
1439 | $ hg shelve |
|
1439 | $ hg shelve | |
1440 | shelved as default |
|
1440 | shelved as default | |
1441 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1441 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1442 | $ hg branch |
|
1442 | $ hg branch | |
1443 | default |
|
1443 | default | |
1444 | $ echo "ccc" >> a |
|
1444 | $ echo "ccc" >> a | |
1445 | $ hg status |
|
1445 | $ hg status | |
1446 | M a |
|
1446 | M a | |
1447 | $ hg unshelve |
|
1447 | $ hg unshelve | |
1448 | unshelving change 'default' |
|
1448 | unshelving change 'default' | |
1449 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
1449 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
1450 | rebasing shelved changes |
|
1450 | rebasing shelved changes | |
1451 | rebasing 2:425c97ef07f3 "changes to: a" (tip) |
|
1451 | rebasing 2:425c97ef07f3 "changes to: a" (tip) | |
1452 | merging a |
|
1452 | merging a | |
1453 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
1453 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
1454 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
1454 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
1455 | [1] |
|
1455 | [1] | |
1456 | $ echo "aaabbbccc" > a |
|
1456 | $ echo "aaabbbccc" > a | |
1457 | $ rm a.orig |
|
1457 | $ rm a.orig | |
1458 | $ hg resolve --mark a |
|
1458 | $ hg resolve --mark a | |
1459 | (no more unresolved files) |
|
1459 | (no more unresolved files) | |
1460 | continue: hg unshelve --continue |
|
1460 | continue: hg unshelve --continue | |
1461 | $ hg unshelve --continue |
|
1461 | $ hg unshelve --continue | |
1462 | rebasing 2:425c97ef07f3 "changes to: a" (tip) |
|
1462 | rebasing 2:425c97ef07f3 "changes to: a" (tip) | |
1463 | marked working directory as branch test |
|
1463 | marked working directory as branch test | |
1464 | unshelve of 'default' complete |
|
1464 | unshelve of 'default' complete | |
1465 | $ cat a |
|
1465 | $ cat a | |
1466 | aaabbbccc |
|
1466 | aaabbbccc | |
1467 | $ hg status |
|
1467 | $ hg status | |
1468 | M a |
|
1468 | M a | |
1469 | $ hg branch |
|
1469 | $ hg branch | |
1470 | test |
|
1470 | test | |
1471 | $ hg commit -m "test-commit" |
|
1471 | $ hg commit -m "test-commit" | |
1472 |
|
1472 | |||
1473 | When i shelve on test branch, update to default branch |
|
1473 | When i shelve on test branch, update to default branch | |
1474 | and unshelve i expect that it will not preserve previous |
|
1474 | and unshelve i expect that it will not preserve previous | |
1475 | test branch. |
|
1475 | test branch. | |
1476 |
|
1476 | |||
1477 | $ echo "xxx" > b |
|
1477 | $ echo "xxx" > b | |
1478 | $ hg add b |
|
1478 | $ hg add b | |
1479 | $ hg shelve |
|
1479 | $ hg shelve | |
1480 | shelved as test |
|
1480 | shelved as test | |
1481 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1481 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1482 | $ hg update -r default |
|
1482 | $ hg update -r default | |
1483 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1483 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1484 | $ hg unshelve |
|
1484 | $ hg unshelve | |
1485 | unshelving change 'test' |
|
1485 | unshelving change 'test' | |
1486 | rebasing shelved changes |
|
1486 | rebasing shelved changes | |
1487 | rebasing 2:357525f34729 "changes to: test-commit" (tip) |
|
1487 | rebasing 2:357525f34729 "changes to: test-commit" (tip) | |
1488 | $ hg status |
|
1488 | $ hg status | |
1489 | A b |
|
1489 | A b | |
1490 | $ hg branch |
|
1490 | $ hg branch | |
1491 | default |
|
1491 | default | |
1492 |
|
1492 | |||
1493 | When i unshelve resulting in merge conflicts and makes saved |
|
1493 | When i unshelve resulting in merge conflicts and makes saved | |
1494 | file shelvedstate looks like in previous versions in |
|
1494 | file shelvedstate looks like in previous versions in | |
1495 | mercurial(without restore branch information in 7th line) i |
|
1495 | mercurial(without restore branch information in 7th line) i | |
1496 | expect that after resolving conflicts and succesfully |
|
1496 | expect that after resolving conflicts and succesfully | |
1497 | running 'shelve --continue' the branch information won't be |
|
1497 | running 'shelve --continue' the branch information won't be | |
1498 | restored and branch will be unchanged. |
|
1498 | restored and branch will be unchanged. | |
1499 |
|
1499 | |||
1500 | shelve on new branch, conflict with previous shelvedstate |
|
1500 | shelve on new branch, conflict with previous shelvedstate | |
1501 |
|
1501 | |||
1502 | $ hg init conflict |
|
1502 | $ hg init conflict | |
1503 | $ cd conflict |
|
1503 | $ cd conflict | |
1504 | $ echo "aaa" >> a |
|
1504 | $ echo "aaa" >> a | |
1505 | $ hg commit -A -m "a" |
|
1505 | $ hg commit -A -m "a" | |
1506 | adding a |
|
1506 | adding a | |
1507 | $ hg branch |
|
1507 | $ hg branch | |
1508 | default |
|
1508 | default | |
1509 | $ hg branch test |
|
1509 | $ hg branch test | |
1510 | marked working directory as branch test |
|
1510 | marked working directory as branch test | |
1511 | (branches are permanent and global, did you want a bookmark?) |
|
1511 | (branches are permanent and global, did you want a bookmark?) | |
1512 | $ echo "bbb" >> a |
|
1512 | $ echo "bbb" >> a | |
1513 | $ hg status |
|
1513 | $ hg status | |
1514 | M a |
|
1514 | M a | |
1515 | $ hg shelve |
|
1515 | $ hg shelve | |
1516 | shelved as default |
|
1516 | shelved as default | |
1517 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1517 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1518 | $ hg branch |
|
1518 | $ hg branch | |
1519 | default |
|
1519 | default | |
1520 | $ echo "ccc" >> a |
|
1520 | $ echo "ccc" >> a | |
1521 | $ hg status |
|
1521 | $ hg status | |
1522 | M a |
|
1522 | M a | |
1523 | $ hg unshelve |
|
1523 | $ hg unshelve | |
1524 | unshelving change 'default' |
|
1524 | unshelving change 'default' | |
1525 | temporarily committing pending changes (restore with 'hg unshelve --abort') |
|
1525 | temporarily committing pending changes (restore with 'hg unshelve --abort') | |
1526 | rebasing shelved changes |
|
1526 | rebasing shelved changes | |
1527 | rebasing 2:425c97ef07f3 "changes to: a" (tip) |
|
1527 | rebasing 2:425c97ef07f3 "changes to: a" (tip) | |
1528 | merging a |
|
1528 | merging a | |
1529 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
1529 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
1530 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
1530 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
1531 | [1] |
|
1531 | [1] | |
1532 |
|
1532 | |||
1533 | Removing restore branch information from shelvedstate file(making it looks like |
|
1533 | Removing restore branch information from shelvedstate file(making it looks like | |
1534 | in previous versions) and running unshelve --continue |
|
1534 | in previous versions) and running unshelve --continue | |
1535 |
|
1535 | |||
1536 | $ head -n 6 < .hg/shelvedstate > .hg/shelvedstate_oldformat |
|
1536 | $ head -n 6 < .hg/shelvedstate > .hg/shelvedstate_oldformat | |
1537 | $ rm .hg/shelvedstate |
|
1537 | $ rm .hg/shelvedstate | |
1538 | $ mv .hg/shelvedstate_oldformat .hg/shelvedstate |
|
1538 | $ mv .hg/shelvedstate_oldformat .hg/shelvedstate | |
1539 |
|
1539 | |||
1540 | $ echo "aaabbbccc" > a |
|
1540 | $ echo "aaabbbccc" > a | |
1541 | $ rm a.orig |
|
1541 | $ rm a.orig | |
1542 | $ hg resolve --mark a |
|
1542 | $ hg resolve --mark a | |
1543 | (no more unresolved files) |
|
1543 | (no more unresolved files) | |
1544 | continue: hg unshelve --continue |
|
1544 | continue: hg unshelve --continue | |
1545 | $ hg unshelve --continue |
|
1545 | $ hg unshelve --continue | |
1546 | rebasing 2:425c97ef07f3 "changes to: a" (tip) |
|
1546 | rebasing 2:425c97ef07f3 "changes to: a" (tip) | |
1547 | unshelve of 'default' complete |
|
1547 | unshelve of 'default' complete | |
1548 | $ cat a |
|
1548 | $ cat a | |
1549 | aaabbbccc |
|
1549 | aaabbbccc | |
1550 | $ hg status |
|
1550 | $ hg status | |
1551 | M a |
|
1551 | M a | |
1552 | $ hg branch |
|
1552 | $ hg branch | |
1553 | default |
|
1553 | default | |
1554 |
|
1554 | |||
1555 | On non bare shelve the branch information shouldn't be restored |
|
1555 | On non bare shelve the branch information shouldn't be restored | |
1556 |
|
1556 | |||
1557 | $ hg init bare_shelve_on_new_branch |
|
1557 | $ hg init bare_shelve_on_new_branch | |
1558 | $ cd bare_shelve_on_new_branch |
|
1558 | $ cd bare_shelve_on_new_branch | |
1559 | $ echo "aaa" >> a |
|
1559 | $ echo "aaa" >> a | |
1560 | $ hg commit -A -m "a" |
|
1560 | $ hg commit -A -m "a" | |
1561 | adding a |
|
1561 | adding a | |
1562 | $ hg branch |
|
1562 | $ hg branch | |
1563 | default |
|
1563 | default | |
1564 | $ hg branch test |
|
1564 | $ hg branch test | |
1565 | marked working directory as branch test |
|
1565 | marked working directory as branch test | |
1566 | (branches are permanent and global, did you want a bookmark?) |
|
1566 | (branches are permanent and global, did you want a bookmark?) | |
1567 | $ echo "bbb" >> a |
|
1567 | $ echo "bbb" >> a | |
1568 | $ hg status |
|
1568 | $ hg status | |
1569 | M a |
|
1569 | M a | |
1570 | $ hg shelve a |
|
1570 | $ hg shelve a | |
1571 | shelved as default |
|
1571 | shelved as default | |
1572 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1572 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1573 | $ hg branch |
|
1573 | $ hg branch | |
1574 | test |
|
1574 | test | |
1575 | $ hg branch default |
|
1575 | $ hg branch default | |
1576 | marked working directory as branch default |
|
1576 | marked working directory as branch default | |
1577 | (branches are permanent and global, did you want a bookmark?) |
|
1577 | (branches are permanent and global, did you want a bookmark?) | |
1578 | $ echo "bbb" >> b |
|
1578 | $ echo "bbb" >> b | |
1579 | $ hg status |
|
1579 | $ hg status | |
1580 | ? b |
|
1580 | ? b | |
1581 | $ hg unshelve |
|
1581 | $ hg unshelve | |
1582 | unshelving change 'default' |
|
1582 | unshelving change 'default' | |
1583 | $ hg status |
|
1583 | $ hg status | |
1584 | M a |
|
1584 | M a | |
1585 | ? b |
|
1585 | ? b | |
1586 | $ hg branch |
|
1586 | $ hg branch | |
1587 | default |
|
1587 | default | |
|
1588 | $ cd .. | |||
|
1589 | ||||
|
1590 | Prepare unshleve with a corrupted shelvedstate | |||
|
1591 | $ hg init r1 && cd r1 | |||
|
1592 | $ echo text1 > file && hg add file | |||
|
1593 | $ hg shelve | |||
|
1594 | shelved as default | |||
|
1595 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
1596 | $ echo text2 > file && hg ci -Am text1 | |||
|
1597 | adding file | |||
|
1598 | $ hg unshelve | |||
|
1599 | unshelving change 'default' | |||
|
1600 | rebasing shelved changes | |||
|
1601 | rebasing 1:396ea74229f9 "(changes in empty repository)" (tip) | |||
|
1602 | merging file | |||
|
1603 | warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |||
|
1604 | unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |||
|
1605 | [1] | |||
|
1606 | $ echo somethingsomething > .hg/shelvedstate | |||
|
1607 | ||||
|
1608 | Unshelve --continue fails with appropriate message if shelvedstate is corrupted | |||
|
1609 | $ hg unshelve --continue | |||
|
1610 | abort: corrupted shelved state file | |||
|
1611 | (please run hg unshelve --abort to abort unshelve operation) | |||
|
1612 | [255] | |||
|
1613 | ||||
|
1614 | Unshelve --abort works with a corrupted shelvedstate | |||
|
1615 | $ hg unshelve --abort | |||
|
1616 | could not read shelved state file, your working copy may be in an unexpected state | |||
|
1617 | please update to some commit | |||
|
1618 | ||||
|
1619 | Unshelve --abort fails with appropriate message if there's no unshelve in | |||
|
1620 | progress | |||
|
1621 | $ hg unshelve --abort | |||
|
1622 | abort: no unshelve in progress | |||
|
1623 | [255] | |||
|
1624 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now