##// END OF EJS Templates
strip: ignore orphaned internal changesets while computing safe strip roots...
Boris Feld -
r39781:b2ec7955 default
parent child Browse files
Show More
@@ -1,441 +1,443 b''
1 # repair.py - functions for repository repair for mercurial
1 # repair.py - functions for repository repair for mercurial
2 #
2 #
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
4 # Copyright 2007 Matt Mackall
4 # Copyright 2007 Matt Mackall
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import errno
11 import errno
12 import hashlib
12 import hashlib
13
13
14 from .i18n import _
14 from .i18n import _
15 from .node import (
15 from .node import (
16 hex,
16 hex,
17 short,
17 short,
18 )
18 )
19 from . import (
19 from . import (
20 bundle2,
20 bundle2,
21 changegroup,
21 changegroup,
22 discovery,
22 discovery,
23 error,
23 error,
24 exchange,
24 exchange,
25 obsolete,
25 obsolete,
26 obsutil,
26 obsutil,
27 phases,
27 pycompat,
28 pycompat,
28 util,
29 util,
29 )
30 )
30 from .utils import (
31 from .utils import (
31 stringutil,
32 stringutil,
32 )
33 )
33
34
34 def backupbundle(repo, bases, heads, node, suffix, compress=True,
35 def backupbundle(repo, bases, heads, node, suffix, compress=True,
35 obsolescence=True):
36 obsolescence=True):
36 """create a bundle with the specified revisions as a backup"""
37 """create a bundle with the specified revisions as a backup"""
37
38
38 backupdir = "strip-backup"
39 backupdir = "strip-backup"
39 vfs = repo.vfs
40 vfs = repo.vfs
40 if not vfs.isdir(backupdir):
41 if not vfs.isdir(backupdir):
41 vfs.mkdir(backupdir)
42 vfs.mkdir(backupdir)
42
43
43 # Include a hash of all the nodes in the filename for uniqueness
44 # Include a hash of all the nodes in the filename for uniqueness
44 allcommits = repo.set('%ln::%ln', bases, heads)
45 allcommits = repo.set('%ln::%ln', bases, heads)
45 allhashes = sorted(c.hex() for c in allcommits)
46 allhashes = sorted(c.hex() for c in allcommits)
46 totalhash = hashlib.sha1(''.join(allhashes)).digest()
47 totalhash = hashlib.sha1(''.join(allhashes)).digest()
47 name = "%s/%s-%s-%s.hg" % (backupdir, short(node),
48 name = "%s/%s-%s-%s.hg" % (backupdir, short(node),
48 hex(totalhash[:4]), suffix)
49 hex(totalhash[:4]), suffix)
49
50
50 cgversion = changegroup.localversion(repo)
51 cgversion = changegroup.localversion(repo)
51 comp = None
52 comp = None
52 if cgversion != '01':
53 if cgversion != '01':
53 bundletype = "HG20"
54 bundletype = "HG20"
54 if compress:
55 if compress:
55 comp = 'BZ'
56 comp = 'BZ'
56 elif compress:
57 elif compress:
57 bundletype = "HG10BZ"
58 bundletype = "HG10BZ"
58 else:
59 else:
59 bundletype = "HG10UN"
60 bundletype = "HG10UN"
60
61
61 outgoing = discovery.outgoing(repo, missingroots=bases, missingheads=heads)
62 outgoing = discovery.outgoing(repo, missingroots=bases, missingheads=heads)
62 contentopts = {
63 contentopts = {
63 'cg.version': cgversion,
64 'cg.version': cgversion,
64 'obsolescence': obsolescence,
65 'obsolescence': obsolescence,
65 'phases': True,
66 'phases': True,
66 }
67 }
67 return bundle2.writenewbundle(repo.ui, repo, 'strip', name, bundletype,
68 return bundle2.writenewbundle(repo.ui, repo, 'strip', name, bundletype,
68 outgoing, contentopts, vfs, compression=comp)
69 outgoing, contentopts, vfs, compression=comp)
69
70
70 def _collectfiles(repo, striprev):
71 def _collectfiles(repo, striprev):
71 """find out the filelogs affected by the strip"""
72 """find out the filelogs affected by the strip"""
72 files = set()
73 files = set()
73
74
74 for x in pycompat.xrange(striprev, len(repo)):
75 for x in pycompat.xrange(striprev, len(repo)):
75 files.update(repo[x].files())
76 files.update(repo[x].files())
76
77
77 return sorted(files)
78 return sorted(files)
78
79
79 def _collectrevlog(revlog, striprev):
80 def _collectrevlog(revlog, striprev):
80 _, brokenset = revlog.getstrippoint(striprev)
81 _, brokenset = revlog.getstrippoint(striprev)
81 return [revlog.linkrev(r) for r in brokenset]
82 return [revlog.linkrev(r) for r in brokenset]
82
83
83 def _collectmanifest(repo, striprev):
84 def _collectmanifest(repo, striprev):
84 return _collectrevlog(repo.manifestlog.getstorage(b''), striprev)
85 return _collectrevlog(repo.manifestlog.getstorage(b''), striprev)
85
86
86 def _collectbrokencsets(repo, files, striprev):
87 def _collectbrokencsets(repo, files, striprev):
87 """return the changesets which will be broken by the truncation"""
88 """return the changesets which will be broken by the truncation"""
88 s = set()
89 s = set()
89
90
90 s.update(_collectmanifest(repo, striprev))
91 s.update(_collectmanifest(repo, striprev))
91 for fname in files:
92 for fname in files:
92 s.update(_collectrevlog(repo.file(fname), striprev))
93 s.update(_collectrevlog(repo.file(fname), striprev))
93
94
94 return s
95 return s
95
96
96 def strip(ui, repo, nodelist, backup=True, topic='backup'):
97 def strip(ui, repo, nodelist, backup=True, topic='backup'):
97 # This function requires the caller to lock the repo, but it operates
98 # This function requires the caller to lock the repo, but it operates
98 # within a transaction of its own, and thus requires there to be no current
99 # within a transaction of its own, and thus requires there to be no current
99 # transaction when it is called.
100 # transaction when it is called.
100 if repo.currenttransaction() is not None:
101 if repo.currenttransaction() is not None:
101 raise error.ProgrammingError('cannot strip from inside a transaction')
102 raise error.ProgrammingError('cannot strip from inside a transaction')
102
103
103 # Simple way to maintain backwards compatibility for this
104 # Simple way to maintain backwards compatibility for this
104 # argument.
105 # argument.
105 if backup in ['none', 'strip']:
106 if backup in ['none', 'strip']:
106 backup = False
107 backup = False
107
108
108 repo = repo.unfiltered()
109 repo = repo.unfiltered()
109 repo.destroying()
110 repo.destroying()
110
111
111 cl = repo.changelog
112 cl = repo.changelog
112 # TODO handle undo of merge sets
113 # TODO handle undo of merge sets
113 if isinstance(nodelist, str):
114 if isinstance(nodelist, str):
114 nodelist = [nodelist]
115 nodelist = [nodelist]
115 striplist = [cl.rev(node) for node in nodelist]
116 striplist = [cl.rev(node) for node in nodelist]
116 striprev = min(striplist)
117 striprev = min(striplist)
117
118
118 files = _collectfiles(repo, striprev)
119 files = _collectfiles(repo, striprev)
119 saverevs = _collectbrokencsets(repo, files, striprev)
120 saverevs = _collectbrokencsets(repo, files, striprev)
120
121
121 # Some revisions with rev > striprev may not be descendants of striprev.
122 # Some revisions with rev > striprev may not be descendants of striprev.
122 # We have to find these revisions and put them in a bundle, so that
123 # We have to find these revisions and put them in a bundle, so that
123 # we can restore them after the truncations.
124 # we can restore them after the truncations.
124 # To create the bundle we use repo.changegroupsubset which requires
125 # To create the bundle we use repo.changegroupsubset which requires
125 # the list of heads and bases of the set of interesting revisions.
126 # the list of heads and bases of the set of interesting revisions.
126 # (head = revision in the set that has no descendant in the set;
127 # (head = revision in the set that has no descendant in the set;
127 # base = revision in the set that has no ancestor in the set)
128 # base = revision in the set that has no ancestor in the set)
128 tostrip = set(striplist)
129 tostrip = set(striplist)
129 saveheads = set(saverevs)
130 saveheads = set(saverevs)
130 for r in cl.revs(start=striprev + 1):
131 for r in cl.revs(start=striprev + 1):
131 if any(p in tostrip for p in cl.parentrevs(r)):
132 if any(p in tostrip for p in cl.parentrevs(r)):
132 tostrip.add(r)
133 tostrip.add(r)
133
134
134 if r not in tostrip:
135 if r not in tostrip:
135 saverevs.add(r)
136 saverevs.add(r)
136 saveheads.difference_update(cl.parentrevs(r))
137 saveheads.difference_update(cl.parentrevs(r))
137 saveheads.add(r)
138 saveheads.add(r)
138 saveheads = [cl.node(r) for r in saveheads]
139 saveheads = [cl.node(r) for r in saveheads]
139
140
140 # compute base nodes
141 # compute base nodes
141 if saverevs:
142 if saverevs:
142 descendants = set(cl.descendants(saverevs))
143 descendants = set(cl.descendants(saverevs))
143 saverevs.difference_update(descendants)
144 saverevs.difference_update(descendants)
144 savebases = [cl.node(r) for r in saverevs]
145 savebases = [cl.node(r) for r in saverevs]
145 stripbases = [cl.node(r) for r in tostrip]
146 stripbases = [cl.node(r) for r in tostrip]
146
147
147 stripobsidx = obsmarkers = ()
148 stripobsidx = obsmarkers = ()
148 if repo.ui.configbool('devel', 'strip-obsmarkers'):
149 if repo.ui.configbool('devel', 'strip-obsmarkers'):
149 obsmarkers = obsutil.exclusivemarkers(repo, stripbases)
150 obsmarkers = obsutil.exclusivemarkers(repo, stripbases)
150 if obsmarkers:
151 if obsmarkers:
151 stripobsidx = [i for i, m in enumerate(repo.obsstore)
152 stripobsidx = [i for i, m in enumerate(repo.obsstore)
152 if m in obsmarkers]
153 if m in obsmarkers]
153
154
154 # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but
155 # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but
155 # is much faster
156 # is much faster
156 newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
157 newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
157 if newbmtarget:
158 if newbmtarget:
158 newbmtarget = repo[newbmtarget.first()].node()
159 newbmtarget = repo[newbmtarget.first()].node()
159 else:
160 else:
160 newbmtarget = '.'
161 newbmtarget = '.'
161
162
162 bm = repo._bookmarks
163 bm = repo._bookmarks
163 updatebm = []
164 updatebm = []
164 for m in bm:
165 for m in bm:
165 rev = repo[bm[m]].rev()
166 rev = repo[bm[m]].rev()
166 if rev in tostrip:
167 if rev in tostrip:
167 updatebm.append(m)
168 updatebm.append(m)
168
169
169 # create a changegroup for all the branches we need to keep
170 # create a changegroup for all the branches we need to keep
170 backupfile = None
171 backupfile = None
171 vfs = repo.vfs
172 vfs = repo.vfs
172 node = nodelist[-1]
173 node = nodelist[-1]
173 if backup:
174 if backup:
174 backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
175 backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
175 repo.ui.status(_("saved backup bundle to %s\n") %
176 repo.ui.status(_("saved backup bundle to %s\n") %
176 vfs.join(backupfile))
177 vfs.join(backupfile))
177 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
178 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
178 vfs.join(backupfile))
179 vfs.join(backupfile))
179 tmpbundlefile = None
180 tmpbundlefile = None
180 if saveheads:
181 if saveheads:
181 # do not compress temporary bundle if we remove it from disk later
182 # do not compress temporary bundle if we remove it from disk later
182 #
183 #
183 # We do not include obsolescence, it might re-introduce prune markers
184 # We do not include obsolescence, it might re-introduce prune markers
184 # we are trying to strip. This is harmless since the stripped markers
185 # we are trying to strip. This is harmless since the stripped markers
185 # are already backed up and we did not touched the markers for the
186 # are already backed up and we did not touched the markers for the
186 # saved changesets.
187 # saved changesets.
187 tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp',
188 tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp',
188 compress=False, obsolescence=False)
189 compress=False, obsolescence=False)
189
190
190 with ui.uninterruptable():
191 with ui.uninterruptable():
191 try:
192 try:
192 with repo.transaction("strip") as tr:
193 with repo.transaction("strip") as tr:
193 # TODO this code violates the interface abstraction of the
194 # TODO this code violates the interface abstraction of the
194 # transaction and makes assumptions that file storage is
195 # transaction and makes assumptions that file storage is
195 # using append-only files. We'll need some kind of storage
196 # using append-only files. We'll need some kind of storage
196 # API to handle stripping for us.
197 # API to handle stripping for us.
197 offset = len(tr._entries)
198 offset = len(tr._entries)
198
199
199 tr.startgroup()
200 tr.startgroup()
200 cl.strip(striprev, tr)
201 cl.strip(striprev, tr)
201 stripmanifest(repo, striprev, tr, files)
202 stripmanifest(repo, striprev, tr, files)
202
203
203 for fn in files:
204 for fn in files:
204 repo.file(fn).strip(striprev, tr)
205 repo.file(fn).strip(striprev, tr)
205 tr.endgroup()
206 tr.endgroup()
206
207
207 for i in pycompat.xrange(offset, len(tr._entries)):
208 for i in pycompat.xrange(offset, len(tr._entries)):
208 file, troffset, ignore = tr._entries[i]
209 file, troffset, ignore = tr._entries[i]
209 with repo.svfs(file, 'a', checkambig=True) as fp:
210 with repo.svfs(file, 'a', checkambig=True) as fp:
210 fp.truncate(troffset)
211 fp.truncate(troffset)
211 if troffset == 0:
212 if troffset == 0:
212 repo.store.markremoved(file)
213 repo.store.markremoved(file)
213
214
214 deleteobsmarkers(repo.obsstore, stripobsidx)
215 deleteobsmarkers(repo.obsstore, stripobsidx)
215 del repo.obsstore
216 del repo.obsstore
216 repo.invalidatevolatilesets()
217 repo.invalidatevolatilesets()
217 repo._phasecache.filterunknown(repo)
218 repo._phasecache.filterunknown(repo)
218
219
219 if tmpbundlefile:
220 if tmpbundlefile:
220 ui.note(_("adding branch\n"))
221 ui.note(_("adding branch\n"))
221 f = vfs.open(tmpbundlefile, "rb")
222 f = vfs.open(tmpbundlefile, "rb")
222 gen = exchange.readbundle(ui, f, tmpbundlefile, vfs)
223 gen = exchange.readbundle(ui, f, tmpbundlefile, vfs)
223 if not repo.ui.verbose:
224 if not repo.ui.verbose:
224 # silence internal shuffling chatter
225 # silence internal shuffling chatter
225 repo.ui.pushbuffer()
226 repo.ui.pushbuffer()
226 tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile)
227 tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile)
227 txnname = 'strip'
228 txnname = 'strip'
228 if not isinstance(gen, bundle2.unbundle20):
229 if not isinstance(gen, bundle2.unbundle20):
229 txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
230 txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
230 with repo.transaction(txnname) as tr:
231 with repo.transaction(txnname) as tr:
231 bundle2.applybundle(repo, gen, tr, source='strip',
232 bundle2.applybundle(repo, gen, tr, source='strip',
232 url=tmpbundleurl)
233 url=tmpbundleurl)
233 if not repo.ui.verbose:
234 if not repo.ui.verbose:
234 repo.ui.popbuffer()
235 repo.ui.popbuffer()
235 f.close()
236 f.close()
236
237
237 with repo.transaction('repair') as tr:
238 with repo.transaction('repair') as tr:
238 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm]
239 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm]
239 bm.applychanges(repo, tr, bmchanges)
240 bm.applychanges(repo, tr, bmchanges)
240
241
241 # remove undo files
242 # remove undo files
242 for undovfs, undofile in repo.undofiles():
243 for undovfs, undofile in repo.undofiles():
243 try:
244 try:
244 undovfs.unlink(undofile)
245 undovfs.unlink(undofile)
245 except OSError as e:
246 except OSError as e:
246 if e.errno != errno.ENOENT:
247 if e.errno != errno.ENOENT:
247 ui.warn(_('error removing %s: %s\n') %
248 ui.warn(_('error removing %s: %s\n') %
248 (undovfs.join(undofile),
249 (undovfs.join(undofile),
249 stringutil.forcebytestr(e)))
250 stringutil.forcebytestr(e)))
250
251
251 except: # re-raises
252 except: # re-raises
252 if backupfile:
253 if backupfile:
253 ui.warn(_("strip failed, backup bundle stored in '%s'\n")
254 ui.warn(_("strip failed, backup bundle stored in '%s'\n")
254 % vfs.join(backupfile))
255 % vfs.join(backupfile))
255 if tmpbundlefile:
256 if tmpbundlefile:
256 ui.warn(_("strip failed, unrecovered changes stored in '%s'\n")
257 ui.warn(_("strip failed, unrecovered changes stored in '%s'\n")
257 % vfs.join(tmpbundlefile))
258 % vfs.join(tmpbundlefile))
258 ui.warn(_("(fix the problem, then recover the changesets with "
259 ui.warn(_("(fix the problem, then recover the changesets with "
259 "\"hg unbundle '%s'\")\n") % vfs.join(tmpbundlefile))
260 "\"hg unbundle '%s'\")\n") % vfs.join(tmpbundlefile))
260 raise
261 raise
261 else:
262 else:
262 if tmpbundlefile:
263 if tmpbundlefile:
263 # Remove temporary bundle only if there were no exceptions
264 # Remove temporary bundle only if there were no exceptions
264 vfs.unlink(tmpbundlefile)
265 vfs.unlink(tmpbundlefile)
265
266
266 repo.destroyed()
267 repo.destroyed()
267 # return the backup file path (or None if 'backup' was False) so
268 # return the backup file path (or None if 'backup' was False) so
268 # extensions can use it
269 # extensions can use it
269 return backupfile
270 return backupfile
270
271
271 def safestriproots(ui, repo, nodes):
272 def safestriproots(ui, repo, nodes):
272 """return list of roots of nodes where descendants are covered by nodes"""
273 """return list of roots of nodes where descendants are covered by nodes"""
273 torev = repo.unfiltered().changelog.rev
274 torev = repo.unfiltered().changelog.rev
274 revs = set(torev(n) for n in nodes)
275 revs = set(torev(n) for n in nodes)
275 # tostrip = wanted - unsafe = wanted - ancestors(orphaned)
276 # tostrip = wanted - unsafe = wanted - ancestors(orphaned)
276 # orphaned = affected - wanted
277 # orphaned = affected - wanted
277 # affected = descendants(roots(wanted))
278 # affected = descendants(roots(wanted))
278 # wanted = revs
279 # wanted = revs
279 tostrip = set(repo.revs('%ld-(::((roots(%ld)::)-%ld))', revs, revs, revs))
280 revset = '%ld - ( ::( (roots(%ld):: and not _phase(%s)) -%ld) )'
281 tostrip = set(repo.revs(revset, revs, revs, phases.internal, revs))
280 notstrip = revs - tostrip
282 notstrip = revs - tostrip
281 if notstrip:
283 if notstrip:
282 nodestr = ', '.join(sorted(short(repo[n].node()) for n in notstrip))
284 nodestr = ', '.join(sorted(short(repo[n].node()) for n in notstrip))
283 ui.warn(_('warning: orphaned descendants detected, '
285 ui.warn(_('warning: orphaned descendants detected, '
284 'not stripping %s\n') % nodestr)
286 'not stripping %s\n') % nodestr)
285 return [c.node() for c in repo.set('roots(%ld)', tostrip)]
287 return [c.node() for c in repo.set('roots(%ld)', tostrip)]
286
288
287 class stripcallback(object):
289 class stripcallback(object):
288 """used as a transaction postclose callback"""
290 """used as a transaction postclose callback"""
289
291
290 def __init__(self, ui, repo, backup, topic):
292 def __init__(self, ui, repo, backup, topic):
291 self.ui = ui
293 self.ui = ui
292 self.repo = repo
294 self.repo = repo
293 self.backup = backup
295 self.backup = backup
294 self.topic = topic or 'backup'
296 self.topic = topic or 'backup'
295 self.nodelist = []
297 self.nodelist = []
296
298
297 def addnodes(self, nodes):
299 def addnodes(self, nodes):
298 self.nodelist.extend(nodes)
300 self.nodelist.extend(nodes)
299
301
300 def __call__(self, tr):
302 def __call__(self, tr):
301 roots = safestriproots(self.ui, self.repo, self.nodelist)
303 roots = safestriproots(self.ui, self.repo, self.nodelist)
302 if roots:
304 if roots:
303 strip(self.ui, self.repo, roots, self.backup, self.topic)
305 strip(self.ui, self.repo, roots, self.backup, self.topic)
304
306
305 def delayedstrip(ui, repo, nodelist, topic=None, backup=True):
307 def delayedstrip(ui, repo, nodelist, topic=None, backup=True):
306 """like strip, but works inside transaction and won't strip irreverent revs
308 """like strip, but works inside transaction and won't strip irreverent revs
307
309
308 nodelist must explicitly contain all descendants. Otherwise a warning will
310 nodelist must explicitly contain all descendants. Otherwise a warning will
309 be printed that some nodes are not stripped.
311 be printed that some nodes are not stripped.
310
312
311 Will do a backup if `backup` is True. The last non-None "topic" will be
313 Will do a backup if `backup` is True. The last non-None "topic" will be
312 used as the backup topic name. The default backup topic name is "backup".
314 used as the backup topic name. The default backup topic name is "backup".
313 """
315 """
314 tr = repo.currenttransaction()
316 tr = repo.currenttransaction()
315 if not tr:
317 if not tr:
316 nodes = safestriproots(ui, repo, nodelist)
318 nodes = safestriproots(ui, repo, nodelist)
317 return strip(ui, repo, nodes, backup=backup, topic=topic)
319 return strip(ui, repo, nodes, backup=backup, topic=topic)
318 # transaction postclose callbacks are called in alphabet order.
320 # transaction postclose callbacks are called in alphabet order.
319 # use '\xff' as prefix so we are likely to be called last.
321 # use '\xff' as prefix so we are likely to be called last.
320 callback = tr.getpostclose('\xffstrip')
322 callback = tr.getpostclose('\xffstrip')
321 if callback is None:
323 if callback is None:
322 callback = stripcallback(ui, repo, backup=backup, topic=topic)
324 callback = stripcallback(ui, repo, backup=backup, topic=topic)
323 tr.addpostclose('\xffstrip', callback)
325 tr.addpostclose('\xffstrip', callback)
324 if topic:
326 if topic:
325 callback.topic = topic
327 callback.topic = topic
326 callback.addnodes(nodelist)
328 callback.addnodes(nodelist)
327
329
328 def stripmanifest(repo, striprev, tr, files):
330 def stripmanifest(repo, striprev, tr, files):
329 revlog = repo.manifestlog.getstorage(b'')
331 revlog = repo.manifestlog.getstorage(b'')
330 revlog.strip(striprev, tr)
332 revlog.strip(striprev, tr)
331 striptrees(repo, tr, striprev, files)
333 striptrees(repo, tr, striprev, files)
332
334
333 def striptrees(repo, tr, striprev, files):
335 def striptrees(repo, tr, striprev, files):
334 if 'treemanifest' in repo.requirements: # safe but unnecessary
336 if 'treemanifest' in repo.requirements: # safe but unnecessary
335 # otherwise
337 # otherwise
336 for unencoded, encoded, size in repo.store.datafiles():
338 for unencoded, encoded, size in repo.store.datafiles():
337 if (unencoded.startswith('meta/') and
339 if (unencoded.startswith('meta/') and
338 unencoded.endswith('00manifest.i')):
340 unencoded.endswith('00manifest.i')):
339 dir = unencoded[5:-12]
341 dir = unencoded[5:-12]
340 repo.manifestlog.getstorage(dir).strip(striprev, tr)
342 repo.manifestlog.getstorage(dir).strip(striprev, tr)
341
343
342 def rebuildfncache(ui, repo):
344 def rebuildfncache(ui, repo):
343 """Rebuilds the fncache file from repo history.
345 """Rebuilds the fncache file from repo history.
344
346
345 Missing entries will be added. Extra entries will be removed.
347 Missing entries will be added. Extra entries will be removed.
346 """
348 """
347 repo = repo.unfiltered()
349 repo = repo.unfiltered()
348
350
349 if 'fncache' not in repo.requirements:
351 if 'fncache' not in repo.requirements:
350 ui.warn(_('(not rebuilding fncache because repository does not '
352 ui.warn(_('(not rebuilding fncache because repository does not '
351 'support fncache)\n'))
353 'support fncache)\n'))
352 return
354 return
353
355
354 with repo.lock():
356 with repo.lock():
355 fnc = repo.store.fncache
357 fnc = repo.store.fncache
356 # Trigger load of fncache.
358 # Trigger load of fncache.
357 if 'irrelevant' in fnc:
359 if 'irrelevant' in fnc:
358 pass
360 pass
359
361
360 oldentries = set(fnc.entries)
362 oldentries = set(fnc.entries)
361 newentries = set()
363 newentries = set()
362 seenfiles = set()
364 seenfiles = set()
363
365
364 progress = ui.makeprogress(_('rebuilding'), unit=_('changesets'),
366 progress = ui.makeprogress(_('rebuilding'), unit=_('changesets'),
365 total=len(repo))
367 total=len(repo))
366 for rev in repo:
368 for rev in repo:
367 progress.update(rev)
369 progress.update(rev)
368
370
369 ctx = repo[rev]
371 ctx = repo[rev]
370 for f in ctx.files():
372 for f in ctx.files():
371 # This is to minimize I/O.
373 # This is to minimize I/O.
372 if f in seenfiles:
374 if f in seenfiles:
373 continue
375 continue
374 seenfiles.add(f)
376 seenfiles.add(f)
375
377
376 i = 'data/%s.i' % f
378 i = 'data/%s.i' % f
377 d = 'data/%s.d' % f
379 d = 'data/%s.d' % f
378
380
379 if repo.store._exists(i):
381 if repo.store._exists(i):
380 newentries.add(i)
382 newentries.add(i)
381 if repo.store._exists(d):
383 if repo.store._exists(d):
382 newentries.add(d)
384 newentries.add(d)
383
385
384 progress.complete()
386 progress.complete()
385
387
386 if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise
388 if 'treemanifest' in repo.requirements: # safe but unnecessary otherwise
387 for dir in util.dirs(seenfiles):
389 for dir in util.dirs(seenfiles):
388 i = 'meta/%s/00manifest.i' % dir
390 i = 'meta/%s/00manifest.i' % dir
389 d = 'meta/%s/00manifest.d' % dir
391 d = 'meta/%s/00manifest.d' % dir
390
392
391 if repo.store._exists(i):
393 if repo.store._exists(i):
392 newentries.add(i)
394 newentries.add(i)
393 if repo.store._exists(d):
395 if repo.store._exists(d):
394 newentries.add(d)
396 newentries.add(d)
395
397
396 addcount = len(newentries - oldentries)
398 addcount = len(newentries - oldentries)
397 removecount = len(oldentries - newentries)
399 removecount = len(oldentries - newentries)
398 for p in sorted(oldentries - newentries):
400 for p in sorted(oldentries - newentries):
399 ui.write(_('removing %s\n') % p)
401 ui.write(_('removing %s\n') % p)
400 for p in sorted(newentries - oldentries):
402 for p in sorted(newentries - oldentries):
401 ui.write(_('adding %s\n') % p)
403 ui.write(_('adding %s\n') % p)
402
404
403 if addcount or removecount:
405 if addcount or removecount:
404 ui.write(_('%d items added, %d removed from fncache\n') %
406 ui.write(_('%d items added, %d removed from fncache\n') %
405 (addcount, removecount))
407 (addcount, removecount))
406 fnc.entries = newentries
408 fnc.entries = newentries
407 fnc._dirty = True
409 fnc._dirty = True
408
410
409 with repo.transaction('fncache') as tr:
411 with repo.transaction('fncache') as tr:
410 fnc.write(tr)
412 fnc.write(tr)
411 else:
413 else:
412 ui.write(_('fncache already up to date\n'))
414 ui.write(_('fncache already up to date\n'))
413
415
414 def deleteobsmarkers(obsstore, indices):
416 def deleteobsmarkers(obsstore, indices):
415 """Delete some obsmarkers from obsstore and return how many were deleted
417 """Delete some obsmarkers from obsstore and return how many were deleted
416
418
417 'indices' is a list of ints which are the indices
419 'indices' is a list of ints which are the indices
418 of the markers to be deleted.
420 of the markers to be deleted.
419
421
420 Every invocation of this function completely rewrites the obsstore file,
422 Every invocation of this function completely rewrites the obsstore file,
421 skipping the markers we want to be removed. The new temporary file is
423 skipping the markers we want to be removed. The new temporary file is
422 created, remaining markers are written there and on .close() this file
424 created, remaining markers are written there and on .close() this file
423 gets atomically renamed to obsstore, thus guaranteeing consistency."""
425 gets atomically renamed to obsstore, thus guaranteeing consistency."""
424 if not indices:
426 if not indices:
425 # we don't want to rewrite the obsstore with the same content
427 # we don't want to rewrite the obsstore with the same content
426 return
428 return
427
429
428 left = []
430 left = []
429 current = obsstore._all
431 current = obsstore._all
430 n = 0
432 n = 0
431 for i, m in enumerate(current):
433 for i, m in enumerate(current):
432 if i in indices:
434 if i in indices:
433 n += 1
435 n += 1
434 continue
436 continue
435 left.append(m)
437 left.append(m)
436
438
437 newobsstorefile = obsstore.svfs('obsstore', 'w', atomictemp=True)
439 newobsstorefile = obsstore.svfs('obsstore', 'w', atomictemp=True)
438 for bytes in obsolete.encodemarkers(left, True, obsstore._version):
440 for bytes in obsolete.encodemarkers(left, True, obsstore._version):
439 newobsstorefile.write(bytes)
441 newobsstorefile.write(bytes)
440 newobsstorefile.close()
442 newobsstorefile.close()
441 return n
443 return n
@@ -1,1875 +1,1866 b''
1 #testcases stripbased phasebased
1 #testcases stripbased phasebased
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > mq =
5 > mq =
6 > shelve =
6 > shelve =
7 > [defaults]
7 > [defaults]
8 > diff = --nodates --git
8 > diff = --nodates --git
9 > qnew = --date '0 0'
9 > qnew = --date '0 0'
10 > [shelve]
10 > [shelve]
11 > maxbackups = 2
11 > maxbackups = 2
12 > EOF
12 > EOF
13
13
14 #if phasebased
14 #if phasebased
15
15
16 $ cat <<EOF >> $HGRCPATH
16 $ cat <<EOF >> $HGRCPATH
17 > [format]
17 > [format]
18 > internal-phase = yes
18 > internal-phase = yes
19 > EOF
19 > EOF
20
20
21 #endif
21 #endif
22
22
23 $ hg init repo
23 $ hg init repo
24 $ cd repo
24 $ cd repo
25 $ mkdir a b
25 $ mkdir a b
26 $ echo a > a/a
26 $ echo a > a/a
27 $ echo b > b/b
27 $ echo b > b/b
28 $ echo c > c
28 $ echo c > c
29 $ echo d > d
29 $ echo d > d
30 $ echo x > x
30 $ echo x > x
31 $ hg addremove -q
31 $ hg addremove -q
32
32
33 shelve has a help message
33 shelve has a help message
34 $ hg shelve -h
34 $ hg shelve -h
35 hg shelve [OPTION]... [FILE]...
35 hg shelve [OPTION]... [FILE]...
36
36
37 save and set aside changes from the working directory
37 save and set aside changes from the working directory
38
38
39 Shelving takes files that "hg status" reports as not clean, saves the
39 Shelving takes files that "hg status" reports as not clean, saves the
40 modifications to a bundle (a shelved change), and reverts the files so
40 modifications to a bundle (a shelved change), and reverts the files so
41 that their state in the working directory becomes clean.
41 that their state in the working directory becomes clean.
42
42
43 To restore these changes to the working directory, using "hg unshelve";
43 To restore these changes to the working directory, using "hg unshelve";
44 this will work even if you switch to a different commit.
44 this will work even if you switch to a different commit.
45
45
46 When no files are specified, "hg shelve" saves all not-clean files. If
46 When no files are specified, "hg shelve" saves all not-clean files. If
47 specific files or directories are named, only changes to those files are
47 specific files or directories are named, only changes to those files are
48 shelved.
48 shelved.
49
49
50 In bare shelve (when no files are specified, without interactive, include
50 In bare shelve (when no files are specified, without interactive, include
51 and exclude option), shelving remembers information if the working
51 and exclude option), shelving remembers information if the working
52 directory was on newly created branch, in other words working directory
52 directory was on newly created branch, in other words working directory
53 was on different branch than its first parent. In this situation
53 was on different branch than its first parent. In this situation
54 unshelving restores branch information to the working directory.
54 unshelving restores branch information to the working directory.
55
55
56 Each shelved change has a name that makes it easier to find later. The
56 Each shelved change has a name that makes it easier to find later. The
57 name of a shelved change defaults to being based on the active bookmark,
57 name of a shelved change defaults to being based on the active bookmark,
58 or if there is no active bookmark, the current named branch. To specify a
58 or if there is no active bookmark, the current named branch. To specify a
59 different name, use "--name".
59 different name, use "--name".
60
60
61 To see a list of existing shelved changes, use the "--list" option. For
61 To see a list of existing shelved changes, use the "--list" option. For
62 each shelved change, this will print its name, age, and description; use "
62 each shelved change, this will print its name, age, and description; use "
63 --patch" or "--stat" for more details.
63 --patch" or "--stat" for more details.
64
64
65 To delete specific shelved changes, use "--delete". To delete all shelved
65 To delete specific shelved changes, use "--delete". To delete all shelved
66 changes, use "--cleanup".
66 changes, use "--cleanup".
67
67
68 (use 'hg help -e shelve' to show help for the shelve extension)
68 (use 'hg help -e shelve' to show help for the shelve extension)
69
69
70 options ([+] can be repeated):
70 options ([+] can be repeated):
71
71
72 -A --addremove mark new/missing files as added/removed before
72 -A --addremove mark new/missing files as added/removed before
73 shelving
73 shelving
74 -u --unknown store unknown files in the shelve
74 -u --unknown store unknown files in the shelve
75 --cleanup delete all shelved changes
75 --cleanup delete all shelved changes
76 --date DATE shelve with the specified commit date
76 --date DATE shelve with the specified commit date
77 -d --delete delete the named shelved change(s)
77 -d --delete delete the named shelved change(s)
78 -e --edit invoke editor on commit messages
78 -e --edit invoke editor on commit messages
79 -l --list list current shelves
79 -l --list list current shelves
80 -m --message TEXT use text as shelve message
80 -m --message TEXT use text as shelve message
81 -n --name NAME use the given name for the shelved commit
81 -n --name NAME use the given name for the shelved commit
82 -p --patch output patches for changes (provide the names of the
82 -p --patch output patches for changes (provide the names of the
83 shelved changes as positional arguments)
83 shelved changes as positional arguments)
84 -i --interactive interactive mode, only works while creating a shelve
84 -i --interactive interactive mode, only works while creating a shelve
85 --stat output diffstat-style summary of changes (provide
85 --stat output diffstat-style summary of changes (provide
86 the names of the shelved changes as positional
86 the names of the shelved changes as positional
87 arguments)
87 arguments)
88 -I --include PATTERN [+] include names matching the given patterns
88 -I --include PATTERN [+] include names matching the given patterns
89 -X --exclude PATTERN [+] exclude names matching the given patterns
89 -X --exclude PATTERN [+] exclude names matching the given patterns
90 --mq operate on patch repository
90 --mq operate on patch repository
91
91
92 (some details hidden, use --verbose to show complete help)
92 (some details hidden, use --verbose to show complete help)
93
93
94 shelving in an empty repo should be possible
94 shelving in an empty repo should be possible
95 (this tests also that editor is not invoked, if '--edit' is not
95 (this tests also that editor is not invoked, if '--edit' is not
96 specified)
96 specified)
97
97
98 $ HGEDITOR=cat hg shelve
98 $ HGEDITOR=cat hg shelve
99 shelved as default
99 shelved as default
100 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
100 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
101
101
102 $ hg unshelve
102 $ hg unshelve
103 unshelving change 'default'
103 unshelving change 'default'
104
104
105 $ hg commit -q -m 'initial commit'
105 $ hg commit -q -m 'initial commit'
106
106
107 $ hg shelve
107 $ hg shelve
108 nothing changed
108 nothing changed
109 [1]
109 [1]
110
110
111 make sure shelve files were backed up
111 make sure shelve files were backed up
112
112
113 $ ls .hg/shelve-backup
113 $ ls .hg/shelve-backup
114 default.hg
114 default.hg
115 default.patch
115 default.patch
116 default.shelve
116 default.shelve
117
117
118 checks to make sure we dont create a directory or
118 checks to make sure we dont create a directory or
119 hidden file while choosing a new shelve name
119 hidden file while choosing a new shelve name
120
120
121 when we are given a name
121 when we are given a name
122
122
123 $ hg shelve -n foo/bar
123 $ hg shelve -n foo/bar
124 abort: shelved change names can not contain slashes
124 abort: shelved change names can not contain slashes
125 [255]
125 [255]
126 $ hg shelve -n .baz
126 $ hg shelve -n .baz
127 abort: shelved change names can not start with '.'
127 abort: shelved change names can not start with '.'
128 [255]
128 [255]
129 $ hg shelve -n foo\\bar
129 $ hg shelve -n foo\\bar
130 abort: shelved change names can not contain slashes
130 abort: shelved change names can not contain slashes
131 [255]
131 [255]
132
132
133 when shelve has to choose itself
133 when shelve has to choose itself
134
134
135 $ hg branch x/y -q
135 $ hg branch x/y -q
136 $ hg commit -q -m "Branch commit 0"
136 $ hg commit -q -m "Branch commit 0"
137 $ hg shelve
137 $ hg shelve
138 nothing changed
138 nothing changed
139 [1]
139 [1]
140 $ hg branch .x -q
140 $ hg branch .x -q
141 $ hg commit -q -m "Branch commit 1"
141 $ hg commit -q -m "Branch commit 1"
142 $ hg shelve
142 $ hg shelve
143 nothing changed
143 nothing changed
144 [1]
144 [1]
145 $ hg branch x\\y -q
145 $ hg branch x\\y -q
146 $ hg commit -q -m "Branch commit 2"
146 $ hg commit -q -m "Branch commit 2"
147 $ hg shelve
147 $ hg shelve
148 nothing changed
148 nothing changed
149 [1]
149 [1]
150
150
151 cleaning the branches made for name checking tests
151 cleaning the branches made for name checking tests
152
152
153 $ hg up default -q
153 $ hg up default -q
154 $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
154 $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
155
155
156 create an mq patch - shelving should work fine with a patch applied
156 create an mq patch - shelving should work fine with a patch applied
157
157
158 $ echo n > n
158 $ echo n > n
159 $ hg add n
159 $ hg add n
160 $ hg commit n -m second
160 $ hg commit n -m second
161 $ hg qnew second.patch
161 $ hg qnew second.patch
162
162
163 shelve a change that we will delete later
163 shelve a change that we will delete later
164
164
165 $ echo a >> a/a
165 $ echo a >> a/a
166 $ hg shelve
166 $ hg shelve
167 shelved as default
167 shelved as default
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169
169
170 set up some more complex changes to shelve
170 set up some more complex changes to shelve
171
171
172 $ echo a >> a/a
172 $ echo a >> a/a
173 $ hg mv b b.rename
173 $ hg mv b b.rename
174 moving b/b to b.rename/b
174 moving b/b to b.rename/b
175 $ hg cp c c.copy
175 $ hg cp c c.copy
176 $ hg status -C
176 $ hg status -C
177 M a/a
177 M a/a
178 A b.rename/b
178 A b.rename/b
179 b/b
179 b/b
180 A c.copy
180 A c.copy
181 c
181 c
182 R b/b
182 R b/b
183
183
184 the common case - no options or filenames
184 the common case - no options or filenames
185
185
186 $ hg shelve
186 $ hg shelve
187 shelved as default-01
187 shelved as default-01
188 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
188 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
189 $ hg status -C
189 $ hg status -C
190
190
191 ensure that our shelved changes exist
191 ensure that our shelved changes exist
192
192
193 $ hg shelve -l
193 $ hg shelve -l
194 default-01 (*)* changes to: [mq]: second.patch (glob)
194 default-01 (*)* changes to: [mq]: second.patch (glob)
195 default (*)* changes to: [mq]: second.patch (glob)
195 default (*)* changes to: [mq]: second.patch (glob)
196
196
197 $ hg shelve -l -p default
197 $ hg shelve -l -p default
198 default (*)* changes to: [mq]: second.patch (glob)
198 default (*)* changes to: [mq]: second.patch (glob)
199
199
200 diff --git a/a/a b/a/a
200 diff --git a/a/a b/a/a
201 --- a/a/a
201 --- a/a/a
202 +++ b/a/a
202 +++ b/a/a
203 @@ -1,1 +1,2 @@
203 @@ -1,1 +1,2 @@
204 a
204 a
205 +a
205 +a
206
206
207 $ hg shelve --list --addremove
207 $ hg shelve --list --addremove
208 abort: options '--list' and '--addremove' may not be used together
208 abort: options '--list' and '--addremove' may not be used together
209 [255]
209 [255]
210
210
211 delete our older shelved change
211 delete our older shelved change
212
212
213 $ hg shelve -d default
213 $ hg shelve -d default
214 $ hg qfinish -a -q
214 $ hg qfinish -a -q
215
215
216 ensure shelve backups aren't overwritten
216 ensure shelve backups aren't overwritten
217
217
218 $ ls .hg/shelve-backup/
218 $ ls .hg/shelve-backup/
219 default-1.hg
219 default-1.hg
220 default-1.patch
220 default-1.patch
221 default-1.shelve
221 default-1.shelve
222 default.hg
222 default.hg
223 default.patch
223 default.patch
224 default.shelve
224 default.shelve
225
225
226 local edits should not prevent a shelved change from applying
226 local edits should not prevent a shelved change from applying
227
227
228 $ printf "z\na\n" > a/a
228 $ printf "z\na\n" > a/a
229 $ hg unshelve --keep
229 $ hg unshelve --keep
230 unshelving change 'default-01'
230 unshelving change 'default-01'
231 temporarily committing pending changes (restore with 'hg unshelve --abort')
231 temporarily committing pending changes (restore with 'hg unshelve --abort')
232 rebasing shelved changes
232 rebasing shelved changes
233 merging a/a
233 merging a/a
234
234
235 $ hg revert --all -q
235 $ hg revert --all -q
236 $ rm a/a.orig b.rename/b c.copy
236 $ rm a/a.orig b.rename/b c.copy
237
237
238 apply it and make sure our state is as expected
238 apply it and make sure our state is as expected
239
239
240 (this also tests that same timestamp prevents backups from being
240 (this also tests that same timestamp prevents backups from being
241 removed, even though there are more than 'maxbackups' backups)
241 removed, even though there are more than 'maxbackups' backups)
242
242
243 $ f -t .hg/shelve-backup/default.patch
243 $ f -t .hg/shelve-backup/default.patch
244 .hg/shelve-backup/default.patch: file
244 .hg/shelve-backup/default.patch: file
245 $ touch -t 200001010000 .hg/shelve-backup/default.patch
245 $ touch -t 200001010000 .hg/shelve-backup/default.patch
246 $ f -t .hg/shelve-backup/default-1.patch
246 $ f -t .hg/shelve-backup/default-1.patch
247 .hg/shelve-backup/default-1.patch: file
247 .hg/shelve-backup/default-1.patch: file
248 $ touch -t 200001010000 .hg/shelve-backup/default-1.patch
248 $ touch -t 200001010000 .hg/shelve-backup/default-1.patch
249
249
250 $ hg unshelve
250 $ hg unshelve
251 unshelving change 'default-01'
251 unshelving change 'default-01'
252 $ hg status -C
252 $ hg status -C
253 M a/a
253 M a/a
254 A b.rename/b
254 A b.rename/b
255 b/b
255 b/b
256 A c.copy
256 A c.copy
257 c
257 c
258 R b/b
258 R b/b
259 $ hg shelve -l
259 $ hg shelve -l
260
260
261 (both of default.hg and default-1.hg should be still kept, because it
261 (both of default.hg and default-1.hg should be still kept, because it
262 is difficult to decide actual order of them from same timestamp)
262 is difficult to decide actual order of them from same timestamp)
263
263
264 $ ls .hg/shelve-backup/
264 $ ls .hg/shelve-backup/
265 default-01.hg
265 default-01.hg
266 default-01.patch
266 default-01.patch
267 default-01.shelve
267 default-01.shelve
268 default-1.hg
268 default-1.hg
269 default-1.patch
269 default-1.patch
270 default-1.shelve
270 default-1.shelve
271 default.hg
271 default.hg
272 default.patch
272 default.patch
273 default.shelve
273 default.shelve
274
274
275 $ hg unshelve
275 $ hg unshelve
276 abort: no shelved changes to apply!
276 abort: no shelved changes to apply!
277 [255]
277 [255]
278 $ hg unshelve foo
278 $ hg unshelve foo
279 abort: shelved change 'foo' not found
279 abort: shelved change 'foo' not found
280 [255]
280 [255]
281
281
282 named shelves, specific filenames, and "commit messages" should all work
282 named shelves, specific filenames, and "commit messages" should all work
283 (this tests also that editor is invoked, if '--edit' is specified)
283 (this tests also that editor is invoked, if '--edit' is specified)
284
284
285 $ hg status -C
285 $ hg status -C
286 M a/a
286 M a/a
287 A b.rename/b
287 A b.rename/b
288 b/b
288 b/b
289 A c.copy
289 A c.copy
290 c
290 c
291 R b/b
291 R b/b
292 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
292 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
293 wat
293 wat
294
294
295
295
296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
297 HG: Leave message empty to abort commit.
297 HG: Leave message empty to abort commit.
298 HG: --
298 HG: --
299 HG: user: shelve@localhost
299 HG: user: shelve@localhost
300 HG: branch 'default'
300 HG: branch 'default'
301 HG: changed a/a
301 HG: changed a/a
302
302
303 expect "a" to no longer be present, but status otherwise unchanged
303 expect "a" to no longer be present, but status otherwise unchanged
304
304
305 $ hg status -C
305 $ hg status -C
306 A b.rename/b
306 A b.rename/b
307 b/b
307 b/b
308 A c.copy
308 A c.copy
309 c
309 c
310 R b/b
310 R b/b
311 $ hg shelve -l --stat
311 $ hg shelve -l --stat
312 wibble (*) wat (glob)
312 wibble (*) wat (glob)
313 a/a | 1 +
313 a/a | 1 +
314 1 files changed, 1 insertions(+), 0 deletions(-)
314 1 files changed, 1 insertions(+), 0 deletions(-)
315
315
316 and now "a/a" should reappear
316 and now "a/a" should reappear
317
317
318 $ cd a
318 $ cd a
319 $ hg unshelve -q wibble
319 $ hg unshelve -q wibble
320 $ cd ..
320 $ cd ..
321 $ hg status -C
321 $ hg status -C
322 M a/a
322 M a/a
323 A b.rename/b
323 A b.rename/b
324 b/b
324 b/b
325 A c.copy
325 A c.copy
326 c
326 c
327 R b/b
327 R b/b
328
328
329 ensure old shelve backups are being deleted automatically
329 ensure old shelve backups are being deleted automatically
330
330
331 $ ls .hg/shelve-backup/
331 $ ls .hg/shelve-backup/
332 default-01.hg
332 default-01.hg
333 default-01.patch
333 default-01.patch
334 default-01.shelve
334 default-01.shelve
335 wibble.hg
335 wibble.hg
336 wibble.patch
336 wibble.patch
337 wibble.shelve
337 wibble.shelve
338
338
339 cause unshelving to result in a merge with 'a' conflicting
339 cause unshelving to result in a merge with 'a' conflicting
340
340
341 $ hg shelve -q
341 $ hg shelve -q
342 $ echo c>>a/a
342 $ echo c>>a/a
343 $ hg commit -m second
343 $ hg commit -m second
344 $ hg tip --template '{files}\n'
344 $ hg tip --template '{files}\n'
345 a/a
345 a/a
346
346
347 add an unrelated change that should be preserved
347 add an unrelated change that should be preserved
348
348
349 $ mkdir foo
349 $ mkdir foo
350 $ echo foo > foo/foo
350 $ echo foo > foo/foo
351 $ hg add foo/foo
351 $ hg add foo/foo
352
352
353 force a conflicted merge to occur
353 force a conflicted merge to occur
354
354
355 $ hg unshelve
355 $ hg unshelve
356 unshelving change 'default'
356 unshelving change 'default'
357 temporarily committing pending changes (restore with 'hg unshelve --abort')
357 temporarily committing pending changes (restore with 'hg unshelve --abort')
358 rebasing shelved changes
358 rebasing shelved changes
359 merging a/a
359 merging a/a
360 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
360 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
361 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
361 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
362 [1]
362 [1]
363 $ hg status -v
363 $ hg status -v
364 M a/a
364 M a/a
365 M b.rename/b
365 M b.rename/b
366 M c.copy
366 M c.copy
367 R b/b
367 R b/b
368 ? a/a.orig
368 ? a/a.orig
369 # The repository is in an unfinished *unshelve* state.
369 # The repository is in an unfinished *unshelve* state.
370
370
371 # Unresolved merge conflicts:
371 # Unresolved merge conflicts:
372 #
372 #
373 # a/a
373 # a/a
374 #
374 #
375 # To mark files as resolved: hg resolve --mark FILE
375 # To mark files as resolved: hg resolve --mark FILE
376
376
377 # To continue: hg unshelve --continue
377 # To continue: hg unshelve --continue
378 # To abort: hg unshelve --abort
378 # To abort: hg unshelve --abort
379
379
380
380
381 ensure that we have a merge with unresolved conflicts
381 ensure that we have a merge with unresolved conflicts
382
382
383 #if phasebased
383 #if phasebased
384 $ hg heads -q --template '{rev}\n'
384 $ hg heads -q --template '{rev}\n'
385 8
385 8
386 5
386 5
387 $ hg parents -q --template '{rev}\n'
387 $ hg parents -q --template '{rev}\n'
388 8
388 8
389 5
389 5
390 #endif
390 #endif
391
391
392 #if stripbased
392 #if stripbased
393 $ hg heads -q --template '{rev}\n'
393 $ hg heads -q --template '{rev}\n'
394 5
394 5
395 4
395 4
396 $ hg parents -q --template '{rev}\n'
396 $ hg parents -q --template '{rev}\n'
397 4
397 4
398 5
398 5
399 #endif
399 #endif
400
400
401 $ hg status
401 $ hg status
402 M a/a
402 M a/a
403 M b.rename/b
403 M b.rename/b
404 M c.copy
404 M c.copy
405 R b/b
405 R b/b
406 ? a/a.orig
406 ? a/a.orig
407 $ hg diff
407 $ hg diff
408 diff --git a/a/a b/a/a
408 diff --git a/a/a b/a/a
409 --- a/a/a
409 --- a/a/a
410 +++ b/a/a
410 +++ b/a/a
411 @@ -1,2 +1,6 @@
411 @@ -1,2 +1,6 @@
412 a
412 a
413 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit
413 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit
414 c
414 c
415 +=======
415 +=======
416 +a
416 +a
417 +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
417 +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
418 diff --git a/b/b b/b.rename/b
418 diff --git a/b/b b/b.rename/b
419 rename from b/b
419 rename from b/b
420 rename to b.rename/b
420 rename to b.rename/b
421 diff --git a/c b/c.copy
421 diff --git a/c b/c.copy
422 copy from c
422 copy from c
423 copy to c.copy
423 copy to c.copy
424 $ hg resolve -l
424 $ hg resolve -l
425 U a/a
425 U a/a
426
426
427 $ hg shelve
427 $ hg shelve
428 abort: unshelve already in progress
428 abort: unshelve already in progress
429 (use 'hg unshelve --continue' or 'hg unshelve --abort')
429 (use 'hg unshelve --continue' or 'hg unshelve --abort')
430 [255]
430 [255]
431
431
432 abort the unshelve and be happy
432 abort the unshelve and be happy
433
433
434 $ hg status
434 $ hg status
435 M a/a
435 M a/a
436 M b.rename/b
436 M b.rename/b
437 M c.copy
437 M c.copy
438 R b/b
438 R b/b
439 ? a/a.orig
439 ? a/a.orig
440 $ hg unshelve -a
440 $ hg unshelve -a
441 unshelve of 'default' aborted
441 unshelve of 'default' aborted
442 $ hg heads -q
442 $ hg heads -q
443 [37]:2e69b451d1ea (re)
443 [37]:2e69b451d1ea (re)
444 $ hg parents
444 $ hg parents
445 changeset: [37]:2e69b451d1ea (re)
445 changeset: [37]:2e69b451d1ea (re)
446 tag: tip
446 tag: tip
447 parent: 3:509104101065 (?)
447 parent: 3:509104101065 (?)
448 user: test
448 user: test
449 date: Thu Jan 01 00:00:00 1970 +0000
449 date: Thu Jan 01 00:00:00 1970 +0000
450 summary: second
450 summary: second
451
451
452 $ hg resolve -l
452 $ hg resolve -l
453 $ hg status
453 $ hg status
454 A foo/foo
454 A foo/foo
455 ? a/a.orig
455 ? a/a.orig
456
456
457 try to continue with no unshelve underway
457 try to continue with no unshelve underway
458
458
459 $ hg unshelve -c
459 $ hg unshelve -c
460 abort: no unshelve in progress
460 abort: no unshelve in progress
461 [255]
461 [255]
462 $ hg status
462 $ hg status
463 A foo/foo
463 A foo/foo
464 ? a/a.orig
464 ? a/a.orig
465
465
466 redo the unshelve to get a conflict
466 redo the unshelve to get a conflict
467
467
468 $ hg unshelve -q
468 $ hg unshelve -q
469 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
469 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
470 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
470 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
471 [1]
471 [1]
472
472
473 attempt to continue
473 attempt to continue
474
474
475 $ hg unshelve -c
475 $ hg unshelve -c
476 abort: unresolved conflicts, can't continue
476 abort: unresolved conflicts, can't continue
477 (see 'hg resolve', then 'hg unshelve --continue')
477 (see 'hg resolve', then 'hg unshelve --continue')
478 [255]
478 [255]
479
479
480 $ hg revert -r . a/a
480 $ hg revert -r . a/a
481 $ hg resolve -m a/a
481 $ hg resolve -m a/a
482 (no more unresolved files)
482 (no more unresolved files)
483 continue: hg unshelve --continue
483 continue: hg unshelve --continue
484
484
485 $ hg commit -m 'commit while unshelve in progress'
485 $ hg commit -m 'commit while unshelve in progress'
486 abort: unshelve already in progress
486 abort: unshelve already in progress
487 (use 'hg unshelve --continue' or 'hg unshelve --abort')
487 (use 'hg unshelve --continue' or 'hg unshelve --abort')
488 [255]
488 [255]
489
489
490 $ hg graft --continue
490 $ hg graft --continue
491 abort: no graft in progress
491 abort: no graft in progress
492 (continue: hg unshelve --continue)
492 (continue: hg unshelve --continue)
493 [255]
493 [255]
494 $ hg unshelve -c
494 $ hg unshelve -c
495 unshelve of 'default' complete
495 unshelve of 'default' complete
496
496
497 ensure the repo is as we hope
497 ensure the repo is as we hope
498
498
499 $ hg parents
499 $ hg parents
500 changeset: [37]:2e69b451d1ea (re)
500 changeset: [37]:2e69b451d1ea (re)
501 tag: tip
501 tag: tip
502 parent: 3:509104101065 (?)
502 parent: 3:509104101065 (?)
503 user: test
503 user: test
504 date: Thu Jan 01 00:00:00 1970 +0000
504 date: Thu Jan 01 00:00:00 1970 +0000
505 summary: second
505 summary: second
506
506
507 $ hg heads -q
507 $ hg heads -q
508 [37]:2e69b451d1ea (re)
508 [37]:2e69b451d1ea (re)
509
509
510 $ hg status -C
510 $ hg status -C
511 A b.rename/b
511 A b.rename/b
512 b/b
512 b/b
513 A c.copy
513 A c.copy
514 c
514 c
515 A foo/foo
515 A foo/foo
516 R b/b
516 R b/b
517 ? a/a.orig
517 ? a/a.orig
518
518
519 there should be no shelves left
519 there should be no shelves left
520
520
521 $ hg shelve -l
521 $ hg shelve -l
522
522
523 #if execbit
523 #if execbit
524
524
525 ensure that metadata-only changes are shelved
525 ensure that metadata-only changes are shelved
526
526
527 $ chmod +x a/a
527 $ chmod +x a/a
528 $ hg shelve -q -n execbit a/a
528 $ hg shelve -q -n execbit a/a
529 $ hg status a/a
529 $ hg status a/a
530 $ hg unshelve -q execbit
530 $ hg unshelve -q execbit
531 $ hg status a/a
531 $ hg status a/a
532 M a/a
532 M a/a
533 $ hg revert a/a
533 $ hg revert a/a
534
534
535 #endif
535 #endif
536
536
537 #if symlink
537 #if symlink
538
538
539 $ rm a/a
539 $ rm a/a
540 $ ln -s foo a/a
540 $ ln -s foo a/a
541 $ hg shelve -q -n symlink a/a
541 $ hg shelve -q -n symlink a/a
542 $ hg status a/a
542 $ hg status a/a
543 $ hg unshelve -q -n symlink
543 $ hg unshelve -q -n symlink
544 $ hg status a/a
544 $ hg status a/a
545 M a/a
545 M a/a
546 $ hg revert a/a
546 $ hg revert a/a
547
547
548 #endif
548 #endif
549
549
550 set up another conflict between a commit and a shelved change
550 set up another conflict between a commit and a shelved change
551
551
552 $ hg revert -q -C -a
552 $ hg revert -q -C -a
553 $ rm a/a.orig b.rename/b c.copy
553 $ rm a/a.orig b.rename/b c.copy
554 $ echo a >> a/a
554 $ echo a >> a/a
555 $ hg shelve -q
555 $ hg shelve -q
556 $ echo x >> a/a
556 $ echo x >> a/a
557 $ hg ci -m 'create conflict'
557 $ hg ci -m 'create conflict'
558 $ hg add foo/foo
558 $ hg add foo/foo
559
559
560 if we resolve a conflict while unshelving, the unshelve should succeed
560 if we resolve a conflict while unshelving, the unshelve should succeed
561
561
562 $ hg unshelve --tool :merge-other --keep
562 $ hg unshelve --tool :merge-other --keep
563 unshelving change 'default'
563 unshelving change 'default'
564 temporarily committing pending changes (restore with 'hg unshelve --abort')
564 temporarily committing pending changes (restore with 'hg unshelve --abort')
565 rebasing shelved changes
565 rebasing shelved changes
566 merging a/a
566 merging a/a
567 $ hg parents -q
567 $ hg parents -q
568 (4|13):33f7f61e6c5e (re)
568 (4|13):33f7f61e6c5e (re)
569 $ hg shelve -l
569 $ hg shelve -l
570 default (*)* changes to: second (glob)
570 default (*)* changes to: second (glob)
571 $ hg status
571 $ hg status
572 M a/a
572 M a/a
573 A foo/foo
573 A foo/foo
574 $ cat a/a
574 $ cat a/a
575 a
575 a
576 c
576 c
577 a
577 a
578 $ cat > a/a << EOF
578 $ cat > a/a << EOF
579 > a
579 > a
580 > c
580 > c
581 > x
581 > x
582 > EOF
582 > EOF
583
583
584 $ HGMERGE=true hg unshelve
584 $ HGMERGE=true hg unshelve
585 unshelving change 'default'
585 unshelving change 'default'
586 temporarily committing pending changes (restore with 'hg unshelve --abort')
586 temporarily committing pending changes (restore with 'hg unshelve --abort')
587 rebasing shelved changes
587 rebasing shelved changes
588 merging a/a
588 merging a/a
589 note: unshelved changes already existed in the working copy
589 note: unshelved changes already existed in the working copy
590 $ hg parents -q
590 $ hg parents -q
591 (4|13):33f7f61e6c5e (re)
591 (4|13):33f7f61e6c5e (re)
592 $ hg shelve -l
592 $ hg shelve -l
593 $ hg status
593 $ hg status
594 A foo/foo
594 A foo/foo
595 $ cat a/a
595 $ cat a/a
596 a
596 a
597 c
597 c
598 x
598 x
599
599
600 test keep and cleanup
600 test keep and cleanup
601
601
602 $ hg shelve
602 $ hg shelve
603 shelved as default
603 shelved as default
604 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
604 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
605 $ hg shelve --list
605 $ hg shelve --list
606 default (*)* changes to: create conflict (glob)
606 default (*)* changes to: create conflict (glob)
607 $ hg unshelve -k
607 $ hg unshelve -k
608 unshelving change 'default'
608 unshelving change 'default'
609 $ hg shelve --list
609 $ hg shelve --list
610 default (*)* changes to: create conflict (glob)
610 default (*)* changes to: create conflict (glob)
611 $ hg shelve --cleanup
611 $ hg shelve --cleanup
612 $ hg shelve --list
612 $ hg shelve --list
613
613
614 $ hg shelve --cleanup --delete
614 $ hg shelve --cleanup --delete
615 abort: options '--cleanup' and '--delete' may not be used together
615 abort: options '--cleanup' and '--delete' may not be used together
616 [255]
616 [255]
617 $ hg shelve --cleanup --patch
617 $ hg shelve --cleanup --patch
618 abort: options '--cleanup' and '--patch' may not be used together
618 abort: options '--cleanup' and '--patch' may not be used together
619 [255]
619 [255]
620 $ hg shelve --cleanup --message MESSAGE
620 $ hg shelve --cleanup --message MESSAGE
621 abort: options '--cleanup' and '--message' may not be used together
621 abort: options '--cleanup' and '--message' may not be used together
622 [255]
622 [255]
623
623
624 test bookmarks
624 test bookmarks
625
625
626 $ hg bookmark test
626 $ hg bookmark test
627 $ hg bookmark
627 $ hg bookmark
628 \* test (4|13):33f7f61e6c5e (re)
628 \* test (4|13):33f7f61e6c5e (re)
629 $ hg shelve
629 $ hg shelve
630 shelved as test
630 shelved as test
631 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
631 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
632 $ hg bookmark
632 $ hg bookmark
633 \* test (4|13):33f7f61e6c5e (re)
633 \* test (4|13):33f7f61e6c5e (re)
634 $ hg unshelve
634 $ hg unshelve
635 unshelving change 'test'
635 unshelving change 'test'
636 $ hg bookmark
636 $ hg bookmark
637 \* test (4|13):33f7f61e6c5e (re)
637 \* test (4|13):33f7f61e6c5e (re)
638
638
639 shelve should still work even if mq is disabled
639 shelve should still work even if mq is disabled
640
640
641 $ hg --config extensions.mq=! shelve
641 $ hg --config extensions.mq=! shelve
642 shelved as test
642 shelved as test
643 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
643 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
644 $ hg --config extensions.mq=! shelve --list
644 $ hg --config extensions.mq=! shelve --list
645 test (*)* changes to: create conflict (glob)
645 test (*)* changes to: create conflict (glob)
646 $ hg bookmark
646 $ hg bookmark
647 \* test (4|13):33f7f61e6c5e (re)
647 \* test (4|13):33f7f61e6c5e (re)
648 $ hg --config extensions.mq=! unshelve
648 $ hg --config extensions.mq=! unshelve
649 unshelving change 'test'
649 unshelving change 'test'
650 $ hg bookmark
650 $ hg bookmark
651 \* test (4|13):33f7f61e6c5e (re)
651 \* test (4|13):33f7f61e6c5e (re)
652
652
653 shelve should leave dirstate clean (issue4055)
653 shelve should leave dirstate clean (issue4055)
654
654
655 $ cd ..
655 $ cd ..
656 $ hg init shelverebase
656 $ hg init shelverebase
657 $ cd shelverebase
657 $ cd shelverebase
658 $ printf 'x\ny\n' > x
658 $ printf 'x\ny\n' > x
659 $ echo z > z
659 $ echo z > z
660 $ hg commit -Aqm xy
660 $ hg commit -Aqm xy
661 $ echo z >> x
661 $ echo z >> x
662 $ hg commit -Aqm z
662 $ hg commit -Aqm z
663 $ hg up 5c4c67fb7dce
663 $ hg up 5c4c67fb7dce
664 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
664 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 $ printf 'a\nx\ny\nz\n' > x
665 $ printf 'a\nx\ny\nz\n' > x
666 $ hg commit -Aqm xyz
666 $ hg commit -Aqm xyz
667 $ echo c >> z
667 $ echo c >> z
668 $ hg shelve
668 $ hg shelve
669 shelved as default
669 shelved as default
670 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
670 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
671
671
672 #if phasebased
673 $ hg rebase -d 6c103be8f4e4 --config extensions.rebase=
672 $ hg rebase -d 6c103be8f4e4 --config extensions.rebase=
674 rebasing 2:323bfa07f744 "xyz"
673 rebasing 2:323bfa07f744 "xyz"( \(tip\))? (re)
675 merging x
674 merging x
676 warning: orphaned descendants detected, not stripping 323bfa07f744 (?)
675 saved backup bundle to \$TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-(78114325|7ae538ef)-rebase.hg (re)
677 #endif
678
679 #if stripbased
680 $ hg rebase -d 6c103be8f4e4 --config extensions.rebase=
681 rebasing 2:323bfa07f744 "xyz" (tip)
682 merging x
683 saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-rebase.hg
684 #endif
685 $ hg unshelve
676 $ hg unshelve
686 unshelving change 'default'
677 unshelving change 'default'
687 rebasing shelved changes
678 rebasing shelved changes
688 $ hg status
679 $ hg status
689 M z
680 M z
690
681
691 $ cd ..
682 $ cd ..
692
683
693 shelve should only unshelve pending changes (issue4068)
684 shelve should only unshelve pending changes (issue4068)
694
685
695 $ hg init onlypendingchanges
686 $ hg init onlypendingchanges
696 $ cd onlypendingchanges
687 $ cd onlypendingchanges
697 $ touch a
688 $ touch a
698 $ hg ci -Aqm a
689 $ hg ci -Aqm a
699 $ touch b
690 $ touch b
700 $ hg ci -Aqm b
691 $ hg ci -Aqm b
701 $ hg up -q 3903775176ed
692 $ hg up -q 3903775176ed
702 $ touch c
693 $ touch c
703 $ hg ci -Aqm c
694 $ hg ci -Aqm c
704
695
705 $ touch d
696 $ touch d
706 $ hg add d
697 $ hg add d
707 $ hg shelve
698 $ hg shelve
708 shelved as default
699 shelved as default
709 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
700 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
710 $ hg up -q 0e067c57feba
701 $ hg up -q 0e067c57feba
711 $ hg unshelve
702 $ hg unshelve
712 unshelving change 'default'
703 unshelving change 'default'
713 rebasing shelved changes
704 rebasing shelved changes
714 $ hg status
705 $ hg status
715 A d
706 A d
716
707
717 unshelve should work on an ancestor of the original commit
708 unshelve should work on an ancestor of the original commit
718
709
719 $ hg shelve
710 $ hg shelve
720 shelved as default
711 shelved as default
721 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
712 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
722 $ hg up 3903775176ed
713 $ hg up 3903775176ed
723 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
714 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
724 $ hg unshelve
715 $ hg unshelve
725 unshelving change 'default'
716 unshelving change 'default'
726 rebasing shelved changes
717 rebasing shelved changes
727 $ hg status
718 $ hg status
728 A d
719 A d
729
720
730 test bug 4073 we need to enable obsolete markers for it
721 test bug 4073 we need to enable obsolete markers for it
731
722
732 $ cat >> $HGRCPATH << EOF
723 $ cat >> $HGRCPATH << EOF
733 > [experimental]
724 > [experimental]
734 > evolution.createmarkers=True
725 > evolution.createmarkers=True
735 > EOF
726 > EOF
736 $ hg shelve
727 $ hg shelve
737 shelved as default
728 shelved as default
738 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
729 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
739 $ hg debugobsolete `hg log -r 0e067c57feba -T '{node}'`
730 $ hg debugobsolete `hg log -r 0e067c57feba -T '{node}'`
740 obsoleted 1 changesets
731 obsoleted 1 changesets
741 $ hg unshelve
732 $ hg unshelve
742 unshelving change 'default'
733 unshelving change 'default'
743
734
744 unshelve should leave unknown files alone (issue4113)
735 unshelve should leave unknown files alone (issue4113)
745
736
746 $ echo e > e
737 $ echo e > e
747 $ hg shelve
738 $ hg shelve
748 shelved as default
739 shelved as default
749 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
740 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
750 $ hg status
741 $ hg status
751 ? e
742 ? e
752 $ hg unshelve
743 $ hg unshelve
753 unshelving change 'default'
744 unshelving change 'default'
754 $ hg status
745 $ hg status
755 A d
746 A d
756 ? e
747 ? e
757 $ cat e
748 $ cat e
758 e
749 e
759
750
760 unshelve should keep a copy of unknown files
751 unshelve should keep a copy of unknown files
761
752
762 $ hg add e
753 $ hg add e
763 $ hg shelve
754 $ hg shelve
764 shelved as default
755 shelved as default
765 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
756 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
766 $ echo z > e
757 $ echo z > e
767 $ hg unshelve
758 $ hg unshelve
768 unshelving change 'default'
759 unshelving change 'default'
769 $ cat e
760 $ cat e
770 e
761 e
771 $ cat e.orig
762 $ cat e.orig
772 z
763 z
773
764
774
765
775 unshelve and conflicts with tracked and untracked files
766 unshelve and conflicts with tracked and untracked files
776
767
777 preparing:
768 preparing:
778
769
779 $ rm *.orig
770 $ rm *.orig
780 $ hg ci -qm 'commit stuff'
771 $ hg ci -qm 'commit stuff'
781 $ hg phase -p null:
772 $ hg phase -p null:
782
773
783 no other changes - no merge:
774 no other changes - no merge:
784
775
785 $ echo f > f
776 $ echo f > f
786 $ hg add f
777 $ hg add f
787 $ hg shelve
778 $ hg shelve
788 shelved as default
779 shelved as default
789 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
780 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
790 $ echo g > f
781 $ echo g > f
791 $ hg unshelve
782 $ hg unshelve
792 unshelving change 'default'
783 unshelving change 'default'
793 $ hg st
784 $ hg st
794 A f
785 A f
795 ? f.orig
786 ? f.orig
796 $ cat f
787 $ cat f
797 f
788 f
798 $ cat f.orig
789 $ cat f.orig
799 g
790 g
800
791
801 other uncommitted changes - merge:
792 other uncommitted changes - merge:
802
793
803 $ hg st
794 $ hg st
804 A f
795 A f
805 ? f.orig
796 ? f.orig
806 $ hg shelve
797 $ hg shelve
807 shelved as default
798 shelved as default
808 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
799 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
809 #if repobundlerepo
800 #if repobundlerepo
810 $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' --hidden
801 $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' --hidden
811 o [48] changes to: commit stuff shelve@localhost (re)
802 o [48] changes to: commit stuff shelve@localhost (re)
812 |
803 |
813 ~
804 ~
814 #endif
805 #endif
815 $ hg log -G --template '{rev} {desc|firstline} {author}'
806 $ hg log -G --template '{rev} {desc|firstline} {author}'
816 @ [37] commit stuff test (re)
807 @ [37] commit stuff test (re)
817 |
808 |
818 | o 2 c test
809 | o 2 c test
819 |/
810 |/
820 o 0 a test
811 o 0 a test
821
812
822 $ mv f.orig f
813 $ mv f.orig f
823 $ echo 1 > a
814 $ echo 1 > a
824 $ hg unshelve --date '1073741824 0'
815 $ hg unshelve --date '1073741824 0'
825 unshelving change 'default'
816 unshelving change 'default'
826 temporarily committing pending changes (restore with 'hg unshelve --abort')
817 temporarily committing pending changes (restore with 'hg unshelve --abort')
827 rebasing shelved changes
818 rebasing shelved changes
828 merging f
819 merging f
829 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
820 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
830 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
821 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
831 [1]
822 [1]
832
823
833 #if phasebased
824 #if phasebased
834 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
825 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
835 @ 9 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
826 @ 9 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
836 |
827 |
837 | @ 8 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000
828 | @ 8 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000
838 |/
829 |/
839 o 7 commit stuff test 1970-01-01 00:00 +0000
830 o 7 commit stuff test 1970-01-01 00:00 +0000
840 |
831 |
841 | o 2 c test 1970-01-01 00:00 +0000
832 | o 2 c test 1970-01-01 00:00 +0000
842 |/
833 |/
843 o 0 a test 1970-01-01 00:00 +0000
834 o 0 a test 1970-01-01 00:00 +0000
844
835
845 #endif
836 #endif
846
837
847 #if stripbased
838 #if stripbased
848 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
839 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
849 @ 5 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000
840 @ 5 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000
850 |
841 |
851 | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
842 | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
852 |/
843 |/
853 o 3 commit stuff test 1970-01-01 00:00 +0000
844 o 3 commit stuff test 1970-01-01 00:00 +0000
854 |
845 |
855 | o 2 c test 1970-01-01 00:00 +0000
846 | o 2 c test 1970-01-01 00:00 +0000
856 |/
847 |/
857 o 0 a test 1970-01-01 00:00 +0000
848 o 0 a test 1970-01-01 00:00 +0000
858
849
859 #endif
850 #endif
860
851
861 $ hg st
852 $ hg st
862 M f
853 M f
863 ? f.orig
854 ? f.orig
864 $ cat f
855 $ cat f
865 <<<<<<< shelve: d44eae5c3d33 - shelve: pending changes temporary commit
856 <<<<<<< shelve: d44eae5c3d33 - shelve: pending changes temporary commit
866 g
857 g
867 =======
858 =======
868 f
859 f
869 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
860 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
870 $ cat f.orig
861 $ cat f.orig
871 g
862 g
872 $ hg unshelve --abort -t false
863 $ hg unshelve --abort -t false
873 tool option will be ignored
864 tool option will be ignored
874 unshelve of 'default' aborted
865 unshelve of 'default' aborted
875 $ hg st
866 $ hg st
876 M a
867 M a
877 ? f.orig
868 ? f.orig
878 $ cat f.orig
869 $ cat f.orig
879 g
870 g
880 $ hg unshelve
871 $ hg unshelve
881 unshelving change 'default'
872 unshelving change 'default'
882 temporarily committing pending changes (restore with 'hg unshelve --abort')
873 temporarily committing pending changes (restore with 'hg unshelve --abort')
883 rebasing shelved changes
874 rebasing shelved changes
884 $ hg st
875 $ hg st
885 M a
876 M a
886 A f
877 A f
887 ? f.orig
878 ? f.orig
888
879
889 other committed changes - merge:
880 other committed changes - merge:
890
881
891 $ hg shelve f
882 $ hg shelve f
892 shelved as default
883 shelved as default
893 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
884 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
894 $ hg ci a -m 'intermediate other change'
885 $ hg ci a -m 'intermediate other change'
895 $ mv f.orig f
886 $ mv f.orig f
896 $ hg unshelve
887 $ hg unshelve
897 unshelving change 'default'
888 unshelving change 'default'
898 rebasing shelved changes
889 rebasing shelved changes
899 merging f
890 merging f
900 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
891 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
901 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
892 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
902 [1]
893 [1]
903 $ hg st
894 $ hg st
904 M f
895 M f
905 ? f.orig
896 ? f.orig
906 $ cat f
897 $ cat f
907 <<<<<<< shelve: 6b563750f973 - test: intermediate other change
898 <<<<<<< shelve: 6b563750f973 - test: intermediate other change
908 g
899 g
909 =======
900 =======
910 f
901 f
911 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
902 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
912 $ cat f.orig
903 $ cat f.orig
913 g
904 g
914 $ hg unshelve --abort
905 $ hg unshelve --abort
915 unshelve of 'default' aborted
906 unshelve of 'default' aborted
916 $ hg st
907 $ hg st
917 ? f.orig
908 ? f.orig
918 $ cat f.orig
909 $ cat f.orig
919 g
910 g
920 $ hg shelve --delete default
911 $ hg shelve --delete default
921
912
922 Recreate some conflict again
913 Recreate some conflict again
923
914
924 $ cd ../repo
915 $ cd ../repo
925 $ hg up -C -r 2e69b451d1ea
916 $ hg up -C -r 2e69b451d1ea
926 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
917 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
927 (leaving bookmark test)
918 (leaving bookmark test)
928 $ echo y >> a/a
919 $ echo y >> a/a
929 $ hg shelve
920 $ hg shelve
930 shelved as default
921 shelved as default
931 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
922 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
932 $ hg up test
923 $ hg up test
933 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
924 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
934 (activating bookmark test)
925 (activating bookmark test)
935 $ hg bookmark
926 $ hg bookmark
936 \* test (4|13):33f7f61e6c5e (re)
927 \* test (4|13):33f7f61e6c5e (re)
937 $ hg unshelve
928 $ hg unshelve
938 unshelving change 'default'
929 unshelving change 'default'
939 rebasing shelved changes
930 rebasing shelved changes
940 merging a/a
931 merging a/a
941 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
932 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
942 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
933 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
943 [1]
934 [1]
944 $ hg bookmark
935 $ hg bookmark
945 test (4|13):33f7f61e6c5e (re)
936 test (4|13):33f7f61e6c5e (re)
946
937
947 Test that resolving all conflicts in one direction (so that the rebase
938 Test that resolving all conflicts in one direction (so that the rebase
948 is a no-op), works (issue4398)
939 is a no-op), works (issue4398)
949
940
950 $ hg revert -a -r .
941 $ hg revert -a -r .
951 reverting a/a
942 reverting a/a
952 $ hg resolve -m a/a
943 $ hg resolve -m a/a
953 (no more unresolved files)
944 (no more unresolved files)
954 continue: hg unshelve --continue
945 continue: hg unshelve --continue
955 $ hg unshelve -c
946 $ hg unshelve -c
956 note: unshelved changes already existed in the working copy
947 note: unshelved changes already existed in the working copy
957 unshelve of 'default' complete
948 unshelve of 'default' complete
958 $ hg bookmark
949 $ hg bookmark
959 \* test (4|13):33f7f61e6c5e (re)
950 \* test (4|13):33f7f61e6c5e (re)
960 $ hg diff
951 $ hg diff
961 $ hg status
952 $ hg status
962 ? a/a.orig
953 ? a/a.orig
963 ? foo/foo
954 ? foo/foo
964 $ hg summary
955 $ hg summary
965 parent: (4|13):33f7f61e6c5e tip (re)
956 parent: (4|13):33f7f61e6c5e tip (re)
966 create conflict
957 create conflict
967 branch: default
958 branch: default
968 bookmarks: *test
959 bookmarks: *test
969 commit: 2 unknown (clean)
960 commit: 2 unknown (clean)
970 update: (current)
961 update: (current)
971 phases: 5 draft
962 phases: 5 draft
972
963
973 $ hg shelve --delete --stat
964 $ hg shelve --delete --stat
974 abort: options '--delete' and '--stat' may not be used together
965 abort: options '--delete' and '--stat' may not be used together
975 [255]
966 [255]
976 $ hg shelve --delete --name NAME
967 $ hg shelve --delete --name NAME
977 abort: options '--delete' and '--name' may not be used together
968 abort: options '--delete' and '--name' may not be used together
978 [255]
969 [255]
979
970
980 Test interactive shelve
971 Test interactive shelve
981 $ cat <<EOF >> $HGRCPATH
972 $ cat <<EOF >> $HGRCPATH
982 > [ui]
973 > [ui]
983 > interactive = true
974 > interactive = true
984 > EOF
975 > EOF
985 $ echo 'a' >> a/b
976 $ echo 'a' >> a/b
986 $ cat a/a >> a/b
977 $ cat a/a >> a/b
987 $ echo 'x' >> a/b
978 $ echo 'x' >> a/b
988 $ mv a/b a/a
979 $ mv a/b a/a
989 $ echo 'a' >> foo/foo
980 $ echo 'a' >> foo/foo
990 $ hg st
981 $ hg st
991 M a/a
982 M a/a
992 ? a/a.orig
983 ? a/a.orig
993 ? foo/foo
984 ? foo/foo
994 $ cat a/a
985 $ cat a/a
995 a
986 a
996 a
987 a
997 c
988 c
998 x
989 x
999 x
990 x
1000 $ cat foo/foo
991 $ cat foo/foo
1001 foo
992 foo
1002 a
993 a
1003 $ hg shelve --interactive --config ui.interactive=false
994 $ hg shelve --interactive --config ui.interactive=false
1004 abort: running non-interactively
995 abort: running non-interactively
1005 [255]
996 [255]
1006 $ hg shelve --interactive << EOF
997 $ hg shelve --interactive << EOF
1007 > y
998 > y
1008 > y
999 > y
1009 > n
1000 > n
1010 > EOF
1001 > EOF
1011 diff --git a/a/a b/a/a
1002 diff --git a/a/a b/a/a
1012 2 hunks, 2 lines changed
1003 2 hunks, 2 lines changed
1013 examine changes to 'a/a'? [Ynesfdaq?] y
1004 examine changes to 'a/a'? [Ynesfdaq?] y
1014
1005
1015 @@ -1,3 +1,4 @@
1006 @@ -1,3 +1,4 @@
1016 +a
1007 +a
1017 a
1008 a
1018 c
1009 c
1019 x
1010 x
1020 record change 1/2 to 'a/a'? [Ynesfdaq?] y
1011 record change 1/2 to 'a/a'? [Ynesfdaq?] y
1021
1012
1022 @@ -1,3 +2,4 @@
1013 @@ -1,3 +2,4 @@
1023 a
1014 a
1024 c
1015 c
1025 x
1016 x
1026 +x
1017 +x
1027 record change 2/2 to 'a/a'? [Ynesfdaq?] n
1018 record change 2/2 to 'a/a'? [Ynesfdaq?] n
1028
1019
1029 shelved as test
1020 shelved as test
1030 merging a/a
1021 merging a/a
1031 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1022 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1032 $ cat a/a
1023 $ cat a/a
1033 a
1024 a
1034 c
1025 c
1035 x
1026 x
1036 x
1027 x
1037 $ cat foo/foo
1028 $ cat foo/foo
1038 foo
1029 foo
1039 a
1030 a
1040 $ hg st
1031 $ hg st
1041 M a/a
1032 M a/a
1042 ? foo/foo
1033 ? foo/foo
1043 $ hg bookmark
1034 $ hg bookmark
1044 \* test (4|13):33f7f61e6c5e (re)
1035 \* test (4|13):33f7f61e6c5e (re)
1045 $ hg unshelve
1036 $ hg unshelve
1046 unshelving change 'test'
1037 unshelving change 'test'
1047 temporarily committing pending changes (restore with 'hg unshelve --abort')
1038 temporarily committing pending changes (restore with 'hg unshelve --abort')
1048 rebasing shelved changes
1039 rebasing shelved changes
1049 merging a/a
1040 merging a/a
1050 $ hg bookmark
1041 $ hg bookmark
1051 \* test (4|13):33f7f61e6c5e (re)
1042 \* test (4|13):33f7f61e6c5e (re)
1052 $ cat a/a
1043 $ cat a/a
1053 a
1044 a
1054 a
1045 a
1055 c
1046 c
1056 x
1047 x
1057 x
1048 x
1058
1049
1059 shelve --patch and shelve --stat should work with valid shelfnames
1050 shelve --patch and shelve --stat should work with valid shelfnames
1060
1051
1061 $ hg up --clean .
1052 $ hg up --clean .
1062 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1053 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1063 (leaving bookmark test)
1054 (leaving bookmark test)
1064 $ hg shelve --list
1055 $ hg shelve --list
1065 $ echo 'patch a' > shelf-patch-a
1056 $ echo 'patch a' > shelf-patch-a
1066 $ hg add shelf-patch-a
1057 $ hg add shelf-patch-a
1067 $ hg shelve
1058 $ hg shelve
1068 shelved as default
1059 shelved as default
1069 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1060 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1070 $ echo 'patch b' > shelf-patch-b
1061 $ echo 'patch b' > shelf-patch-b
1071 $ hg add shelf-patch-b
1062 $ hg add shelf-patch-b
1072 $ hg shelve
1063 $ hg shelve
1073 shelved as default-01
1064 shelved as default-01
1074 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1065 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1075 $ hg shelve --patch default default-01
1066 $ hg shelve --patch default default-01
1076 default-01 (*)* changes to: create conflict (glob)
1067 default-01 (*)* changes to: create conflict (glob)
1077
1068
1078 diff --git a/shelf-patch-b b/shelf-patch-b
1069 diff --git a/shelf-patch-b b/shelf-patch-b
1079 new file mode 100644
1070 new file mode 100644
1080 --- /dev/null
1071 --- /dev/null
1081 +++ b/shelf-patch-b
1072 +++ b/shelf-patch-b
1082 @@ -0,0 +1,1 @@
1073 @@ -0,0 +1,1 @@
1083 +patch b
1074 +patch b
1084 default (*)* changes to: create conflict (glob)
1075 default (*)* changes to: create conflict (glob)
1085
1076
1086 diff --git a/shelf-patch-a b/shelf-patch-a
1077 diff --git a/shelf-patch-a b/shelf-patch-a
1087 new file mode 100644
1078 new file mode 100644
1088 --- /dev/null
1079 --- /dev/null
1089 +++ b/shelf-patch-a
1080 +++ b/shelf-patch-a
1090 @@ -0,0 +1,1 @@
1081 @@ -0,0 +1,1 @@
1091 +patch a
1082 +patch a
1092 $ hg shelve --stat default default-01
1083 $ hg shelve --stat default default-01
1093 default-01 (*)* changes to: create conflict (glob)
1084 default-01 (*)* changes to: create conflict (glob)
1094 shelf-patch-b | 1 +
1085 shelf-patch-b | 1 +
1095 1 files changed, 1 insertions(+), 0 deletions(-)
1086 1 files changed, 1 insertions(+), 0 deletions(-)
1096 default (*)* changes to: create conflict (glob)
1087 default (*)* changes to: create conflict (glob)
1097 shelf-patch-a | 1 +
1088 shelf-patch-a | 1 +
1098 1 files changed, 1 insertions(+), 0 deletions(-)
1089 1 files changed, 1 insertions(+), 0 deletions(-)
1099 $ hg shelve --patch default
1090 $ hg shelve --patch default
1100 default (*)* changes to: create conflict (glob)
1091 default (*)* changes to: create conflict (glob)
1101
1092
1102 diff --git a/shelf-patch-a b/shelf-patch-a
1093 diff --git a/shelf-patch-a b/shelf-patch-a
1103 new file mode 100644
1094 new file mode 100644
1104 --- /dev/null
1095 --- /dev/null
1105 +++ b/shelf-patch-a
1096 +++ b/shelf-patch-a
1106 @@ -0,0 +1,1 @@
1097 @@ -0,0 +1,1 @@
1107 +patch a
1098 +patch a
1108 $ hg shelve --stat default
1099 $ hg shelve --stat default
1109 default (*)* changes to: create conflict (glob)
1100 default (*)* changes to: create conflict (glob)
1110 shelf-patch-a | 1 +
1101 shelf-patch-a | 1 +
1111 1 files changed, 1 insertions(+), 0 deletions(-)
1102 1 files changed, 1 insertions(+), 0 deletions(-)
1112 $ hg shelve --patch nonexistentshelf
1103 $ hg shelve --patch nonexistentshelf
1113 abort: cannot find shelf nonexistentshelf
1104 abort: cannot find shelf nonexistentshelf
1114 [255]
1105 [255]
1115 $ hg shelve --stat nonexistentshelf
1106 $ hg shelve --stat nonexistentshelf
1116 abort: cannot find shelf nonexistentshelf
1107 abort: cannot find shelf nonexistentshelf
1117 [255]
1108 [255]
1118 $ hg shelve --patch default nonexistentshelf
1109 $ hg shelve --patch default nonexistentshelf
1119 abort: cannot find shelf nonexistentshelf
1110 abort: cannot find shelf nonexistentshelf
1120 [255]
1111 [255]
1121
1112
1122 when the user asks for a patch, we assume they want the most recent shelve if
1113 when the user asks for a patch, we assume they want the most recent shelve if
1123 they don't provide a shelve name
1114 they don't provide a shelve name
1124
1115
1125 $ hg shelve --patch
1116 $ hg shelve --patch
1126 default-01 (*)* changes to: create conflict (glob)
1117 default-01 (*)* changes to: create conflict (glob)
1127
1118
1128 diff --git a/shelf-patch-b b/shelf-patch-b
1119 diff --git a/shelf-patch-b b/shelf-patch-b
1129 new file mode 100644
1120 new file mode 100644
1130 --- /dev/null
1121 --- /dev/null
1131 +++ b/shelf-patch-b
1122 +++ b/shelf-patch-b
1132 @@ -0,0 +1,1 @@
1123 @@ -0,0 +1,1 @@
1133 +patch b
1124 +patch b
1134
1125
1135 $ cd ..
1126 $ cd ..
1136
1127
1137 you shouldn't be able to ask for the patch/stats of the most recent shelve if
1128 you shouldn't be able to ask for the patch/stats of the most recent shelve if
1138 there are no shelves
1129 there are no shelves
1139
1130
1140 $ hg init noshelves
1131 $ hg init noshelves
1141 $ cd noshelves
1132 $ cd noshelves
1142
1133
1143 $ hg shelve --patch
1134 $ hg shelve --patch
1144 abort: there are no shelves to show
1135 abort: there are no shelves to show
1145 [255]
1136 [255]
1146 $ hg shelve --stat
1137 $ hg shelve --stat
1147 abort: there are no shelves to show
1138 abort: there are no shelves to show
1148 [255]
1139 [255]
1149
1140
1150 $ cd ..
1141 $ cd ..
1151
1142
1152 Shelve from general delta repo uses bundle2 on disk
1143 Shelve from general delta repo uses bundle2 on disk
1153 --------------------------------------------------
1144 --------------------------------------------------
1154
1145
1155 no general delta
1146 no general delta
1156
1147
1157 $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0
1148 $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0
1158 requesting all changes
1149 requesting all changes
1159 adding changesets
1150 adding changesets
1160 adding manifests
1151 adding manifests
1161 adding file changes
1152 adding file changes
1162 added 5 changesets with 8 changes to 6 files
1153 added 5 changesets with 8 changes to 6 files
1163 new changesets cc01e2b0c59f:33f7f61e6c5e
1154 new changesets cc01e2b0c59f:33f7f61e6c5e
1164 updating to branch default
1155 updating to branch default
1165 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1156 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1166 $ cd bundle1
1157 $ cd bundle1
1167 $ echo babar > jungle
1158 $ echo babar > jungle
1168 $ hg add jungle
1159 $ hg add jungle
1169 $ hg shelve
1160 $ hg shelve
1170 shelved as default
1161 shelved as default
1171 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1162 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1172 $ hg debugbundle .hg/shelved/*.hg
1163 $ hg debugbundle .hg/shelved/*.hg
1173 330882a04d2ce8487636b1fb292e5beea77fa1e3
1164 330882a04d2ce8487636b1fb292e5beea77fa1e3
1174 $ cd ..
1165 $ cd ..
1175
1166
1176 with general delta
1167 with general delta
1177
1168
1178 $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1
1169 $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1
1179 requesting all changes
1170 requesting all changes
1180 adding changesets
1171 adding changesets
1181 adding manifests
1172 adding manifests
1182 adding file changes
1173 adding file changes
1183 added 5 changesets with 8 changes to 6 files
1174 added 5 changesets with 8 changes to 6 files
1184 new changesets cc01e2b0c59f:33f7f61e6c5e
1175 new changesets cc01e2b0c59f:33f7f61e6c5e
1185 updating to branch default
1176 updating to branch default
1186 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1177 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1187 $ cd bundle2
1178 $ cd bundle2
1188 $ echo babar > jungle
1179 $ echo babar > jungle
1189 $ hg add jungle
1180 $ hg add jungle
1190 $ hg shelve
1181 $ hg shelve
1191 shelved as default
1182 shelved as default
1192 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1183 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1193 $ hg debugbundle .hg/shelved/*.hg
1184 $ hg debugbundle .hg/shelved/*.hg
1194 Stream params: {Compression: BZ}
1185 Stream params: {Compression: BZ}
1195 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
1186 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
1196 330882a04d2ce8487636b1fb292e5beea77fa1e3
1187 330882a04d2ce8487636b1fb292e5beea77fa1e3
1197 $ cd ..
1188 $ cd ..
1198
1189
1199 Test visibility of in-memory changes inside transaction to external hook
1190 Test visibility of in-memory changes inside transaction to external hook
1200 ------------------------------------------------------------------------
1191 ------------------------------------------------------------------------
1201
1192
1202 $ cd repo
1193 $ cd repo
1203
1194
1204 $ echo xxxx >> x
1195 $ echo xxxx >> x
1205 $ hg commit -m "#5: changes to invoke rebase"
1196 $ hg commit -m "#5: changes to invoke rebase"
1206
1197
1207 $ cat > $TESTTMP/checkvisibility.sh <<EOF
1198 $ cat > $TESTTMP/checkvisibility.sh <<EOF
1208 > echo "==== \$1:"
1199 > echo "==== \$1:"
1209 > hg parents --template "VISIBLE {rev}:{node|short}\n"
1200 > hg parents --template "VISIBLE {rev}:{node|short}\n"
1210 > # test that pending changes are hidden
1201 > # test that pending changes are hidden
1211 > unset HG_PENDING
1202 > unset HG_PENDING
1212 > hg parents --template "ACTUAL {rev}:{node|short}\n"
1203 > hg parents --template "ACTUAL {rev}:{node|short}\n"
1213 > echo "===="
1204 > echo "===="
1214 > EOF
1205 > EOF
1215
1206
1216 $ cat >> .hg/hgrc <<EOF
1207 $ cat >> .hg/hgrc <<EOF
1217 > [defaults]
1208 > [defaults]
1218 > # to fix hash id of temporary revisions
1209 > # to fix hash id of temporary revisions
1219 > unshelve = --date '0 0'
1210 > unshelve = --date '0 0'
1220 > EOF
1211 > EOF
1221
1212
1222 "hg unshelve" at REV5 implies steps below:
1213 "hg unshelve" at REV5 implies steps below:
1223
1214
1224 (1) commit changes in the working directory (REV6)
1215 (1) commit changes in the working directory (REV6)
1225 (2) unbundle shelved revision (REV7)
1216 (2) unbundle shelved revision (REV7)
1226 (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7)
1217 (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7)
1227 (4) rebase: commit merged revision (REV8)
1218 (4) rebase: commit merged revision (REV8)
1228 (5) rebase: update to REV6 (REV8 => REV6)
1219 (5) rebase: update to REV6 (REV8 => REV6)
1229 (6) update to REV5 (REV6 => REV5)
1220 (6) update to REV5 (REV6 => REV5)
1230 (7) abort transaction
1221 (7) abort transaction
1231
1222
1232 == test visibility to external preupdate hook
1223 == test visibility to external preupdate hook
1233
1224
1234 $ cat >> .hg/hgrc <<EOF
1225 $ cat >> .hg/hgrc <<EOF
1235 > [hooks]
1226 > [hooks]
1236 > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate
1227 > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate
1237 > EOF
1228 > EOF
1238
1229
1239 $ echo nnnn >> n
1230 $ echo nnnn >> n
1240
1231
1241 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1232 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1242 ==== before-unshelving:
1233 ==== before-unshelving:
1243 VISIBLE (5|19):703117a2acfb (re)
1234 VISIBLE (5|19):703117a2acfb (re)
1244 ACTUAL (5|19):703117a2acfb (re)
1235 ACTUAL (5|19):703117a2acfb (re)
1245 ====
1236 ====
1246
1237
1247 $ hg unshelve --keep default
1238 $ hg unshelve --keep default
1248 temporarily committing pending changes (restore with 'hg unshelve --abort')
1239 temporarily committing pending changes (restore with 'hg unshelve --abort')
1249 rebasing shelved changes
1240 rebasing shelved changes
1250 ==== preupdate:
1241 ==== preupdate:
1251 VISIBLE (6|20):54c00d20fb3f (re)
1242 VISIBLE (6|20):54c00d20fb3f (re)
1252 ACTUAL (5|19):703117a2acfb (re)
1243 ACTUAL (5|19):703117a2acfb (re)
1253 ====
1244 ====
1254 ==== preupdate:
1245 ==== preupdate:
1255 VISIBLE (8|21):8efe6f7537dc (re)
1246 VISIBLE (8|21):8efe6f7537dc (re)
1256 ACTUAL (5|19):703117a2acfb (re)
1247 ACTUAL (5|19):703117a2acfb (re)
1257 ====
1248 ====
1258 ==== preupdate:
1249 ==== preupdate:
1259 VISIBLE (6|20):54c00d20fb3f (re)
1250 VISIBLE (6|20):54c00d20fb3f (re)
1260 ACTUAL (5|19):703117a2acfb (re)
1251 ACTUAL (5|19):703117a2acfb (re)
1261 ====
1252 ====
1262
1253
1263 $ cat >> .hg/hgrc <<EOF
1254 $ cat >> .hg/hgrc <<EOF
1264 > [hooks]
1255 > [hooks]
1265 > preupdate.visibility =
1256 > preupdate.visibility =
1266 > EOF
1257 > EOF
1267
1258
1268 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1259 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1269 ==== after-unshelving:
1260 ==== after-unshelving:
1270 VISIBLE (5|19):703117a2acfb (re)
1261 VISIBLE (5|19):703117a2acfb (re)
1271 ACTUAL (5|19):703117a2acfb (re)
1262 ACTUAL (5|19):703117a2acfb (re)
1272 ====
1263 ====
1273
1264
1274 == test visibility to external update hook
1265 == test visibility to external update hook
1275
1266
1276 $ hg update -q -C 703117a2acfb
1267 $ hg update -q -C 703117a2acfb
1277
1268
1278 $ cat >> .hg/hgrc <<EOF
1269 $ cat >> .hg/hgrc <<EOF
1279 > [hooks]
1270 > [hooks]
1280 > update.visibility = sh $TESTTMP/checkvisibility.sh update
1271 > update.visibility = sh $TESTTMP/checkvisibility.sh update
1281 > EOF
1272 > EOF
1282
1273
1283 $ echo nnnn >> n
1274 $ echo nnnn >> n
1284
1275
1285 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1276 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1286 ==== before-unshelving:
1277 ==== before-unshelving:
1287 VISIBLE (5|19):703117a2acfb (re)
1278 VISIBLE (5|19):703117a2acfb (re)
1288 ACTUAL (5|19):703117a2acfb (re)
1279 ACTUAL (5|19):703117a2acfb (re)
1289 ====
1280 ====
1290
1281
1291 $ hg unshelve --keep default
1282 $ hg unshelve --keep default
1292 temporarily committing pending changes (restore with 'hg unshelve --abort')
1283 temporarily committing pending changes (restore with 'hg unshelve --abort')
1293 rebasing shelved changes
1284 rebasing shelved changes
1294 ==== update:
1285 ==== update:
1295 VISIBLE (6|20):54c00d20fb3f (re)
1286 VISIBLE (6|20):54c00d20fb3f (re)
1296 VISIBLE 1?7:492ed9d705e5 (re)
1287 VISIBLE 1?7:492ed9d705e5 (re)
1297 ACTUAL (5|19):703117a2acfb (re)
1288 ACTUAL (5|19):703117a2acfb (re)
1298 ====
1289 ====
1299 ==== update:
1290 ==== update:
1300 VISIBLE (6|20):54c00d20fb3f (re)
1291 VISIBLE (6|20):54c00d20fb3f (re)
1301 ACTUAL (5|19):703117a2acfb (re)
1292 ACTUAL (5|19):703117a2acfb (re)
1302 ====
1293 ====
1303 ==== update:
1294 ==== update:
1304 VISIBLE (5|19):703117a2acfb (re)
1295 VISIBLE (5|19):703117a2acfb (re)
1305 ACTUAL (5|19):703117a2acfb (re)
1296 ACTUAL (5|19):703117a2acfb (re)
1306 ====
1297 ====
1307
1298
1308 $ cat >> .hg/hgrc <<EOF
1299 $ cat >> .hg/hgrc <<EOF
1309 > [hooks]
1300 > [hooks]
1310 > update.visibility =
1301 > update.visibility =
1311 > EOF
1302 > EOF
1312
1303
1313 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1304 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1314 ==== after-unshelving:
1305 ==== after-unshelving:
1315 VISIBLE (5|19):703117a2acfb (re)
1306 VISIBLE (5|19):703117a2acfb (re)
1316 ACTUAL (5|19):703117a2acfb (re)
1307 ACTUAL (5|19):703117a2acfb (re)
1317 ====
1308 ====
1318
1309
1319 $ cd ..
1310 $ cd ..
1320
1311
1321 test .orig files go where the user wants them to
1312 test .orig files go where the user wants them to
1322 ---------------------------------------------------------------
1313 ---------------------------------------------------------------
1323 $ hg init salvage
1314 $ hg init salvage
1324 $ cd salvage
1315 $ cd salvage
1325 $ echo 'content' > root
1316 $ echo 'content' > root
1326 $ hg commit -A -m 'root' -q
1317 $ hg commit -A -m 'root' -q
1327 $ echo '' > root
1318 $ echo '' > root
1328 $ hg shelve -q
1319 $ hg shelve -q
1329 $ echo 'contADDent' > root
1320 $ echo 'contADDent' > root
1330 $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups'
1321 $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups'
1331 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
1322 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
1332 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1323 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1333 [1]
1324 [1]
1334 $ ls .hg/origbackups
1325 $ ls .hg/origbackups
1335 root
1326 root
1336 $ rm -rf .hg/origbackups
1327 $ rm -rf .hg/origbackups
1337
1328
1338 test Abort unshelve always gets user out of the unshelved state
1329 test Abort unshelve always gets user out of the unshelved state
1339 ---------------------------------------------------------------
1330 ---------------------------------------------------------------
1340
1331
1341 with a corrupted shelve state file
1332 with a corrupted shelve state file
1342 $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate
1333 $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate
1343 $ mv ../corrupt-shelvedstate .hg/shelvestate
1334 $ mv ../corrupt-shelvedstate .hg/shelvestate
1344 $ hg unshelve --abort 2>&1 | grep 'aborted'
1335 $ hg unshelve --abort 2>&1 | grep 'aborted'
1345 unshelve of 'default' aborted
1336 unshelve of 'default' aborted
1346 $ hg summary
1337 $ hg summary
1347 parent: 0:ae8c668541e8 tip
1338 parent: 0:ae8c668541e8 tip
1348 root
1339 root
1349 branch: default
1340 branch: default
1350 commit: 1 modified
1341 commit: 1 modified
1351 update: (current)
1342 update: (current)
1352 phases: 1 draft
1343 phases: 1 draft
1353 $ hg up -C .
1344 $ hg up -C .
1354 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1345 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1355
1346
1356 $ cd ..
1347 $ cd ..
1357
1348
1358 Keep active bookmark while (un)shelving even on shared repo (issue4940)
1349 Keep active bookmark while (un)shelving even on shared repo (issue4940)
1359 -----------------------------------------------------------------------
1350 -----------------------------------------------------------------------
1360
1351
1361 $ cat <<EOF >> $HGRCPATH
1352 $ cat <<EOF >> $HGRCPATH
1362 > [extensions]
1353 > [extensions]
1363 > share =
1354 > share =
1364 > EOF
1355 > EOF
1365
1356
1366 $ hg bookmarks -R repo
1357 $ hg bookmarks -R repo
1367 test (4|13):33f7f61e6c5e (re)
1358 test (4|13):33f7f61e6c5e (re)
1368 $ hg share -B repo share
1359 $ hg share -B repo share
1369 updating working directory
1360 updating working directory
1370 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1361 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1371 $ cd share
1362 $ cd share
1372
1363
1373 $ hg bookmarks
1364 $ hg bookmarks
1374 test (4|13):33f7f61e6c5e (re)
1365 test (4|13):33f7f61e6c5e (re)
1375 $ hg bookmarks foo
1366 $ hg bookmarks foo
1376 $ hg bookmarks
1367 $ hg bookmarks
1377 \* foo (5|19):703117a2acfb (re)
1368 \* foo (5|19):703117a2acfb (re)
1378 test (4|13):33f7f61e6c5e (re)
1369 test (4|13):33f7f61e6c5e (re)
1379 $ echo x >> x
1370 $ echo x >> x
1380 $ hg shelve
1371 $ hg shelve
1381 shelved as foo
1372 shelved as foo
1382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1373 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1383 $ hg bookmarks
1374 $ hg bookmarks
1384 \* foo (5|19):703117a2acfb (re)
1375 \* foo (5|19):703117a2acfb (re)
1385 test (4|13):33f7f61e6c5e (re)
1376 test (4|13):33f7f61e6c5e (re)
1386
1377
1387 $ hg unshelve
1378 $ hg unshelve
1388 unshelving change 'foo'
1379 unshelving change 'foo'
1389 $ hg bookmarks
1380 $ hg bookmarks
1390 \* foo (5|19):703117a2acfb (re)
1381 \* foo (5|19):703117a2acfb (re)
1391 test (4|13):33f7f61e6c5e (re)
1382 test (4|13):33f7f61e6c5e (re)
1392
1383
1393 $ cd ..
1384 $ cd ..
1394
1385
1395 Shelve and unshelve unknown files. For the purposes of unshelve, a shelved
1386 Shelve and unshelve unknown files. For the purposes of unshelve, a shelved
1396 unknown file is the same as a shelved added file, except that it will be in
1387 unknown file is the same as a shelved added file, except that it will be in
1397 unknown state after unshelve if and only if it was either absent or unknown
1388 unknown state after unshelve if and only if it was either absent or unknown
1398 before the unshelve operation.
1389 before the unshelve operation.
1399
1390
1400 $ hg init unknowns
1391 $ hg init unknowns
1401 $ cd unknowns
1392 $ cd unknowns
1402
1393
1403 The simplest case is if I simply have an unknown file that I shelve and unshelve
1394 The simplest case is if I simply have an unknown file that I shelve and unshelve
1404
1395
1405 $ echo unknown > unknown
1396 $ echo unknown > unknown
1406 $ hg status
1397 $ hg status
1407 ? unknown
1398 ? unknown
1408 $ hg shelve --unknown
1399 $ hg shelve --unknown
1409 shelved as default
1400 shelved as default
1410 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1401 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1411 $ hg status
1402 $ hg status
1412 $ hg unshelve
1403 $ hg unshelve
1413 unshelving change 'default'
1404 unshelving change 'default'
1414 $ hg status
1405 $ hg status
1415 ? unknown
1406 ? unknown
1416 $ rm unknown
1407 $ rm unknown
1417
1408
1418 If I shelve, add the file, and unshelve, does it stay added?
1409 If I shelve, add the file, and unshelve, does it stay added?
1419
1410
1420 $ echo unknown > unknown
1411 $ echo unknown > unknown
1421 $ hg shelve -u
1412 $ hg shelve -u
1422 shelved as default
1413 shelved as default
1423 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1414 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1424 $ hg status
1415 $ hg status
1425 $ touch unknown
1416 $ touch unknown
1426 $ hg add unknown
1417 $ hg add unknown
1427 $ hg status
1418 $ hg status
1428 A unknown
1419 A unknown
1429 $ hg unshelve
1420 $ hg unshelve
1430 unshelving change 'default'
1421 unshelving change 'default'
1431 temporarily committing pending changes (restore with 'hg unshelve --abort')
1422 temporarily committing pending changes (restore with 'hg unshelve --abort')
1432 rebasing shelved changes
1423 rebasing shelved changes
1433 merging unknown
1424 merging unknown
1434 $ hg status
1425 $ hg status
1435 A unknown
1426 A unknown
1436 $ hg forget unknown
1427 $ hg forget unknown
1437 $ rm unknown
1428 $ rm unknown
1438
1429
1439 And if I shelve, commit, then unshelve, does it become modified?
1430 And if I shelve, commit, then unshelve, does it become modified?
1440
1431
1441 $ echo unknown > unknown
1432 $ echo unknown > unknown
1442 $ hg shelve -u
1433 $ hg shelve -u
1443 shelved as default
1434 shelved as default
1444 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1435 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1445 $ hg status
1436 $ hg status
1446 $ touch unknown
1437 $ touch unknown
1447 $ hg add unknown
1438 $ hg add unknown
1448 $ hg commit -qm "Add unknown"
1439 $ hg commit -qm "Add unknown"
1449 $ hg status
1440 $ hg status
1450 $ hg unshelve
1441 $ hg unshelve
1451 unshelving change 'default'
1442 unshelving change 'default'
1452 rebasing shelved changes
1443 rebasing shelved changes
1453 merging unknown
1444 merging unknown
1454 $ hg status
1445 $ hg status
1455 M unknown
1446 M unknown
1456 $ hg remove --force unknown
1447 $ hg remove --force unknown
1457 $ hg commit -qm "Remove unknown"
1448 $ hg commit -qm "Remove unknown"
1458
1449
1459 $ cd ..
1450 $ cd ..
1460
1451
1461 We expects that non-bare shelve keeps newly created branch in
1452 We expects that non-bare shelve keeps newly created branch in
1462 working directory.
1453 working directory.
1463
1454
1464 $ hg init shelve-preserve-new-branch
1455 $ hg init shelve-preserve-new-branch
1465 $ cd shelve-preserve-new-branch
1456 $ cd shelve-preserve-new-branch
1466 $ echo "a" >> a
1457 $ echo "a" >> a
1467 $ hg add a
1458 $ hg add a
1468 $ echo "b" >> b
1459 $ echo "b" >> b
1469 $ hg add b
1460 $ hg add b
1470 $ hg commit -m "ab"
1461 $ hg commit -m "ab"
1471 $ echo "aa" >> a
1462 $ echo "aa" >> a
1472 $ echo "bb" >> b
1463 $ echo "bb" >> b
1473 $ hg branch new-branch
1464 $ hg branch new-branch
1474 marked working directory as branch new-branch
1465 marked working directory as branch new-branch
1475 (branches are permanent and global, did you want a bookmark?)
1466 (branches are permanent and global, did you want a bookmark?)
1476 $ hg status
1467 $ hg status
1477 M a
1468 M a
1478 M b
1469 M b
1479 $ hg branch
1470 $ hg branch
1480 new-branch
1471 new-branch
1481 $ hg shelve a
1472 $ hg shelve a
1482 shelved as default
1473 shelved as default
1483 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1474 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1484 $ hg branch
1475 $ hg branch
1485 new-branch
1476 new-branch
1486 $ hg status
1477 $ hg status
1487 M b
1478 M b
1488 $ touch "c" >> c
1479 $ touch "c" >> c
1489 $ hg add c
1480 $ hg add c
1490 $ hg status
1481 $ hg status
1491 M b
1482 M b
1492 A c
1483 A c
1493 $ hg shelve --exclude c
1484 $ hg shelve --exclude c
1494 shelved as default-01
1485 shelved as default-01
1495 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1486 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1496 $ hg branch
1487 $ hg branch
1497 new-branch
1488 new-branch
1498 $ hg status
1489 $ hg status
1499 A c
1490 A c
1500 $ hg shelve --include c
1491 $ hg shelve --include c
1501 shelved as default-02
1492 shelved as default-02
1502 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1493 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1503 $ hg branch
1494 $ hg branch
1504 new-branch
1495 new-branch
1505 $ hg status
1496 $ hg status
1506 $ echo "d" >> d
1497 $ echo "d" >> d
1507 $ hg add d
1498 $ hg add d
1508 $ hg status
1499 $ hg status
1509 A d
1500 A d
1510
1501
1511 We expect that bare-shelve will not keep branch in current working directory.
1502 We expect that bare-shelve will not keep branch in current working directory.
1512
1503
1513 $ hg shelve
1504 $ hg shelve
1514 shelved as default-03
1505 shelved as default-03
1515 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1506 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1516 $ hg branch
1507 $ hg branch
1517 default
1508 default
1518 $ cd ..
1509 $ cd ..
1519
1510
1520 When i shelve commit on newly created branch i expect
1511 When i shelve commit on newly created branch i expect
1521 that after unshelve newly created branch will be preserved.
1512 that after unshelve newly created branch will be preserved.
1522
1513
1523 $ hg init shelve_on_new_branch_simple
1514 $ hg init shelve_on_new_branch_simple
1524 $ cd shelve_on_new_branch_simple
1515 $ cd shelve_on_new_branch_simple
1525 $ echo "aaa" >> a
1516 $ echo "aaa" >> a
1526 $ hg commit -A -m "a"
1517 $ hg commit -A -m "a"
1527 adding a
1518 adding a
1528 $ hg branch
1519 $ hg branch
1529 default
1520 default
1530 $ hg branch test
1521 $ hg branch test
1531 marked working directory as branch test
1522 marked working directory as branch test
1532 (branches are permanent and global, did you want a bookmark?)
1523 (branches are permanent and global, did you want a bookmark?)
1533 $ echo "bbb" >> a
1524 $ echo "bbb" >> a
1534 $ hg status
1525 $ hg status
1535 M a
1526 M a
1536 $ hg shelve
1527 $ hg shelve
1537 shelved as default
1528 shelved as default
1538 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1529 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1539 $ hg branch
1530 $ hg branch
1540 default
1531 default
1541 $ echo "bbb" >> b
1532 $ echo "bbb" >> b
1542 $ hg status
1533 $ hg status
1543 ? b
1534 ? b
1544 $ hg unshelve
1535 $ hg unshelve
1545 unshelving change 'default'
1536 unshelving change 'default'
1546 marked working directory as branch test
1537 marked working directory as branch test
1547 $ hg status
1538 $ hg status
1548 M a
1539 M a
1549 ? b
1540 ? b
1550 $ hg branch
1541 $ hg branch
1551 test
1542 test
1552 $ cd ..
1543 $ cd ..
1553
1544
1554 When i shelve commit on newly created branch, make
1545 When i shelve commit on newly created branch, make
1555 some changes, unshelve it and running into merge
1546 some changes, unshelve it and running into merge
1556 conflicts i expect that after fixing them and
1547 conflicts i expect that after fixing them and
1557 running unshelve --continue newly created branch
1548 running unshelve --continue newly created branch
1558 will be preserved.
1549 will be preserved.
1559
1550
1560 $ hg init shelve_on_new_branch_conflict
1551 $ hg init shelve_on_new_branch_conflict
1561 $ cd shelve_on_new_branch_conflict
1552 $ cd shelve_on_new_branch_conflict
1562 $ echo "aaa" >> a
1553 $ echo "aaa" >> a
1563 $ hg commit -A -m "a"
1554 $ hg commit -A -m "a"
1564 adding a
1555 adding a
1565 $ hg branch
1556 $ hg branch
1566 default
1557 default
1567 $ hg branch test
1558 $ hg branch test
1568 marked working directory as branch test
1559 marked working directory as branch test
1569 (branches are permanent and global, did you want a bookmark?)
1560 (branches are permanent and global, did you want a bookmark?)
1570 $ echo "bbb" >> a
1561 $ echo "bbb" >> a
1571 $ hg status
1562 $ hg status
1572 M a
1563 M a
1573 $ hg shelve
1564 $ hg shelve
1574 shelved as default
1565 shelved as default
1575 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1566 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1576 $ hg branch
1567 $ hg branch
1577 default
1568 default
1578 $ echo "ccc" >> a
1569 $ echo "ccc" >> a
1579 $ hg status
1570 $ hg status
1580 M a
1571 M a
1581 $ hg unshelve
1572 $ hg unshelve
1582 unshelving change 'default'
1573 unshelving change 'default'
1583 temporarily committing pending changes (restore with 'hg unshelve --abort')
1574 temporarily committing pending changes (restore with 'hg unshelve --abort')
1584 rebasing shelved changes
1575 rebasing shelved changes
1585 merging a
1576 merging a
1586 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1577 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1587 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1578 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1588 [1]
1579 [1]
1589 $ echo "aaabbbccc" > a
1580 $ echo "aaabbbccc" > a
1590 $ rm a.orig
1581 $ rm a.orig
1591 $ hg resolve --mark a
1582 $ hg resolve --mark a
1592 (no more unresolved files)
1583 (no more unresolved files)
1593 continue: hg unshelve --continue
1584 continue: hg unshelve --continue
1594 $ hg unshelve --continue
1585 $ hg unshelve --continue
1595 marked working directory as branch test
1586 marked working directory as branch test
1596 unshelve of 'default' complete
1587 unshelve of 'default' complete
1597 $ cat a
1588 $ cat a
1598 aaabbbccc
1589 aaabbbccc
1599 $ hg status
1590 $ hg status
1600 M a
1591 M a
1601 $ hg branch
1592 $ hg branch
1602 test
1593 test
1603 $ hg commit -m "test-commit"
1594 $ hg commit -m "test-commit"
1604
1595
1605 When i shelve on test branch, update to default branch
1596 When i shelve on test branch, update to default branch
1606 and unshelve i expect that it will not preserve previous
1597 and unshelve i expect that it will not preserve previous
1607 test branch.
1598 test branch.
1608
1599
1609 $ echo "xxx" > b
1600 $ echo "xxx" > b
1610 $ hg add b
1601 $ hg add b
1611 $ hg shelve
1602 $ hg shelve
1612 shelved as test
1603 shelved as test
1613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1604 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1614 $ hg update -r 7049e48789d7
1605 $ hg update -r 7049e48789d7
1615 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1606 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1616 $ hg unshelve
1607 $ hg unshelve
1617 unshelving change 'test'
1608 unshelving change 'test'
1618 rebasing shelved changes
1609 rebasing shelved changes
1619 $ hg status
1610 $ hg status
1620 A b
1611 A b
1621 $ hg branch
1612 $ hg branch
1622 default
1613 default
1623 $ cd ..
1614 $ cd ..
1624
1615
1625 When i unshelve resulting in merge conflicts and makes saved
1616 When i unshelve resulting in merge conflicts and makes saved
1626 file shelvedstate looks like in previous versions in
1617 file shelvedstate looks like in previous versions in
1627 mercurial(without restore branch information in 7th line) i
1618 mercurial(without restore branch information in 7th line) i
1628 expect that after resolving conflicts and successfully
1619 expect that after resolving conflicts and successfully
1629 running 'shelve --continue' the branch information won't be
1620 running 'shelve --continue' the branch information won't be
1630 restored and branch will be unchanged.
1621 restored and branch will be unchanged.
1631
1622
1632 shelve on new branch, conflict with previous shelvedstate
1623 shelve on new branch, conflict with previous shelvedstate
1633
1624
1634 $ hg init conflict
1625 $ hg init conflict
1635 $ cd conflict
1626 $ cd conflict
1636 $ echo "aaa" >> a
1627 $ echo "aaa" >> a
1637 $ hg commit -A -m "a"
1628 $ hg commit -A -m "a"
1638 adding a
1629 adding a
1639 $ hg branch
1630 $ hg branch
1640 default
1631 default
1641 $ hg branch test
1632 $ hg branch test
1642 marked working directory as branch test
1633 marked working directory as branch test
1643 (branches are permanent and global, did you want a bookmark?)
1634 (branches are permanent and global, did you want a bookmark?)
1644 $ echo "bbb" >> a
1635 $ echo "bbb" >> a
1645 $ hg status
1636 $ hg status
1646 M a
1637 M a
1647 $ hg shelve
1638 $ hg shelve
1648 shelved as default
1639 shelved as default
1649 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1640 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1650 $ hg branch
1641 $ hg branch
1651 default
1642 default
1652 $ echo "ccc" >> a
1643 $ echo "ccc" >> a
1653 $ hg status
1644 $ hg status
1654 M a
1645 M a
1655 $ hg unshelve
1646 $ hg unshelve
1656 unshelving change 'default'
1647 unshelving change 'default'
1657 temporarily committing pending changes (restore with 'hg unshelve --abort')
1648 temporarily committing pending changes (restore with 'hg unshelve --abort')
1658 rebasing shelved changes
1649 rebasing shelved changes
1659 merging a
1650 merging a
1660 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1651 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1661 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1652 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1662 [1]
1653 [1]
1663
1654
1664 Removing restore branch information from shelvedstate file(making it looks like
1655 Removing restore branch information from shelvedstate file(making it looks like
1665 in previous versions) and running unshelve --continue
1656 in previous versions) and running unshelve --continue
1666
1657
1667 $ cp .hg/shelvedstate .hg/shelvedstate_old
1658 $ cp .hg/shelvedstate .hg/shelvedstate_old
1668 $ cat .hg/shelvedstate_old | grep -v 'branchtorestore' > .hg/shelvedstate
1659 $ cat .hg/shelvedstate_old | grep -v 'branchtorestore' > .hg/shelvedstate
1669
1660
1670 $ echo "aaabbbccc" > a
1661 $ echo "aaabbbccc" > a
1671 $ rm a.orig
1662 $ rm a.orig
1672 $ hg resolve --mark a
1663 $ hg resolve --mark a
1673 (no more unresolved files)
1664 (no more unresolved files)
1674 continue: hg unshelve --continue
1665 continue: hg unshelve --continue
1675 $ hg unshelve --continue
1666 $ hg unshelve --continue
1676 unshelve of 'default' complete
1667 unshelve of 'default' complete
1677 $ cat a
1668 $ cat a
1678 aaabbbccc
1669 aaabbbccc
1679 $ hg status
1670 $ hg status
1680 M a
1671 M a
1681 $ hg branch
1672 $ hg branch
1682 default
1673 default
1683 $ cd ..
1674 $ cd ..
1684
1675
1685 On non bare shelve the branch information shouldn't be restored
1676 On non bare shelve the branch information shouldn't be restored
1686
1677
1687 $ hg init bare_shelve_on_new_branch
1678 $ hg init bare_shelve_on_new_branch
1688 $ cd bare_shelve_on_new_branch
1679 $ cd bare_shelve_on_new_branch
1689 $ echo "aaa" >> a
1680 $ echo "aaa" >> a
1690 $ hg commit -A -m "a"
1681 $ hg commit -A -m "a"
1691 adding a
1682 adding a
1692 $ hg branch
1683 $ hg branch
1693 default
1684 default
1694 $ hg branch test
1685 $ hg branch test
1695 marked working directory as branch test
1686 marked working directory as branch test
1696 (branches are permanent and global, did you want a bookmark?)
1687 (branches are permanent and global, did you want a bookmark?)
1697 $ echo "bbb" >> a
1688 $ echo "bbb" >> a
1698 $ hg status
1689 $ hg status
1699 M a
1690 M a
1700 $ hg shelve a
1691 $ hg shelve a
1701 shelved as default
1692 shelved as default
1702 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1693 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1703 $ hg branch
1694 $ hg branch
1704 test
1695 test
1705 $ hg branch default
1696 $ hg branch default
1706 marked working directory as branch default
1697 marked working directory as branch default
1707 (branches are permanent and global, did you want a bookmark?)
1698 (branches are permanent and global, did you want a bookmark?)
1708 $ echo "bbb" >> b
1699 $ echo "bbb" >> b
1709 $ hg status
1700 $ hg status
1710 ? b
1701 ? b
1711 $ hg unshelve
1702 $ hg unshelve
1712 unshelving change 'default'
1703 unshelving change 'default'
1713 $ hg status
1704 $ hg status
1714 M a
1705 M a
1715 ? b
1706 ? b
1716 $ hg branch
1707 $ hg branch
1717 default
1708 default
1718 $ cd ..
1709 $ cd ..
1719
1710
1720 Prepare unshelve with a corrupted shelvedstate
1711 Prepare unshelve with a corrupted shelvedstate
1721 $ hg init r1 && cd r1
1712 $ hg init r1 && cd r1
1722 $ echo text1 > file && hg add file
1713 $ echo text1 > file && hg add file
1723 $ hg shelve
1714 $ hg shelve
1724 shelved as default
1715 shelved as default
1725 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1716 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1726 $ echo text2 > file && hg ci -Am text1
1717 $ echo text2 > file && hg ci -Am text1
1727 adding file
1718 adding file
1728 $ hg unshelve
1719 $ hg unshelve
1729 unshelving change 'default'
1720 unshelving change 'default'
1730 rebasing shelved changes
1721 rebasing shelved changes
1731 merging file
1722 merging file
1732 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1723 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1733 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1724 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1734 [1]
1725 [1]
1735 $ echo somethingsomething > .hg/shelvedstate
1726 $ echo somethingsomething > .hg/shelvedstate
1736
1727
1737 Unshelve --continue fails with appropriate message if shelvedstate is corrupted
1728 Unshelve --continue fails with appropriate message if shelvedstate is corrupted
1738 $ hg unshelve --continue
1729 $ hg unshelve --continue
1739 abort: corrupted shelved state file
1730 abort: corrupted shelved state file
1740 (please run hg unshelve --abort to abort unshelve operation)
1731 (please run hg unshelve --abort to abort unshelve operation)
1741 [255]
1732 [255]
1742
1733
1743 Unshelve --abort works with a corrupted shelvedstate
1734 Unshelve --abort works with a corrupted shelvedstate
1744 $ hg unshelve --abort
1735 $ hg unshelve --abort
1745 could not read shelved state file, your working copy may be in an unexpected state
1736 could not read shelved state file, your working copy may be in an unexpected state
1746 please update to some commit
1737 please update to some commit
1747
1738
1748 Unshelve --abort fails with appropriate message if there's no unshelve in
1739 Unshelve --abort fails with appropriate message if there's no unshelve in
1749 progress
1740 progress
1750 $ hg unshelve --abort
1741 $ hg unshelve --abort
1751 abort: no unshelve in progress
1742 abort: no unshelve in progress
1752 [255]
1743 [255]
1753 $ cd ..
1744 $ cd ..
1754
1745
1755 Unshelve respects --keep even if user intervention is needed
1746 Unshelve respects --keep even if user intervention is needed
1756 $ hg init unshelvekeep && cd unshelvekeep
1747 $ hg init unshelvekeep && cd unshelvekeep
1757 $ echo 1 > file && hg ci -Am 1
1748 $ echo 1 > file && hg ci -Am 1
1758 adding file
1749 adding file
1759 $ echo 2 >> file
1750 $ echo 2 >> file
1760 $ hg shelve
1751 $ hg shelve
1761 shelved as default
1752 shelved as default
1762 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1753 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1763 $ echo 3 >> file && hg ci -Am 13
1754 $ echo 3 >> file && hg ci -Am 13
1764 $ hg shelve --list
1755 $ hg shelve --list
1765 default (*s ago) * changes to: 1 (glob)
1756 default (*s ago) * changes to: 1 (glob)
1766 $ hg unshelve --keep
1757 $ hg unshelve --keep
1767 unshelving change 'default'
1758 unshelving change 'default'
1768 rebasing shelved changes
1759 rebasing shelved changes
1769 merging file
1760 merging file
1770 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1761 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1771 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1762 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1772 [1]
1763 [1]
1773 $ hg resolve --mark file
1764 $ hg resolve --mark file
1774 (no more unresolved files)
1765 (no more unresolved files)
1775 continue: hg unshelve --continue
1766 continue: hg unshelve --continue
1776 $ hg unshelve --continue
1767 $ hg unshelve --continue
1777 unshelve of 'default' complete
1768 unshelve of 'default' complete
1778 $ hg shelve --list
1769 $ hg shelve --list
1779 default (*s ago) * changes to: 1 (glob)
1770 default (*s ago) * changes to: 1 (glob)
1780 $ cd ..
1771 $ cd ..
1781
1772
1782 Unshelving when there are deleted files does not crash (issue4176)
1773 Unshelving when there are deleted files does not crash (issue4176)
1783 $ hg init unshelve-deleted-file && cd unshelve-deleted-file
1774 $ hg init unshelve-deleted-file && cd unshelve-deleted-file
1784 $ echo a > a && echo b > b && hg ci -Am ab
1775 $ echo a > a && echo b > b && hg ci -Am ab
1785 adding a
1776 adding a
1786 adding b
1777 adding b
1787 $ echo aa > a && hg shelve
1778 $ echo aa > a && hg shelve
1788 shelved as default
1779 shelved as default
1789 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1780 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1790 $ rm b
1781 $ rm b
1791 $ hg st
1782 $ hg st
1792 ! b
1783 ! b
1793 $ hg unshelve
1784 $ hg unshelve
1794 unshelving change 'default'
1785 unshelving change 'default'
1795 $ hg shelve
1786 $ hg shelve
1796 shelved as default
1787 shelved as default
1797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1788 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1798 $ rm a && echo b > b
1789 $ rm a && echo b > b
1799 $ hg st
1790 $ hg st
1800 ! a
1791 ! a
1801 $ hg unshelve
1792 $ hg unshelve
1802 unshelving change 'default'
1793 unshelving change 'default'
1803 abort: shelved change touches missing files
1794 abort: shelved change touches missing files
1804 (run hg status to see which files are missing)
1795 (run hg status to see which files are missing)
1805 [255]
1796 [255]
1806 $ hg st
1797 $ hg st
1807 ! a
1798 ! a
1808 $ cd ..
1799 $ cd ..
1809
1800
1810 New versions of Mercurial know how to read onld shelvedstate files
1801 New versions of Mercurial know how to read onld shelvedstate files
1811 $ hg init oldshelvedstate
1802 $ hg init oldshelvedstate
1812 $ cd oldshelvedstate
1803 $ cd oldshelvedstate
1813 $ echo root > root && hg ci -Am root
1804 $ echo root > root && hg ci -Am root
1814 adding root
1805 adding root
1815 $ echo 1 > a
1806 $ echo 1 > a
1816 $ hg add a
1807 $ hg add a
1817 $ hg shelve --name ashelve
1808 $ hg shelve --name ashelve
1818 shelved as ashelve
1809 shelved as ashelve
1819 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1810 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1820 $ echo 2 > a
1811 $ echo 2 > a
1821 $ hg ci -Am a
1812 $ hg ci -Am a
1822 adding a
1813 adding a
1823 $ hg unshelve
1814 $ hg unshelve
1824 unshelving change 'ashelve'
1815 unshelving change 'ashelve'
1825 rebasing shelved changes
1816 rebasing shelved changes
1826 merging a
1817 merging a
1827 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1818 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1828 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1819 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1829 [1]
1820 [1]
1830 putting v1 shelvedstate file in place of a created v2
1821 putting v1 shelvedstate file in place of a created v2
1831 $ cat << EOF > .hg/shelvedstate
1822 $ cat << EOF > .hg/shelvedstate
1832 > 1
1823 > 1
1833 > ashelve
1824 > ashelve
1834 > 8b058dae057a5a78f393f4535d9e363dd5efac9d
1825 > 8b058dae057a5a78f393f4535d9e363dd5efac9d
1835 > 8b058dae057a5a78f393f4535d9e363dd5efac9d
1826 > 8b058dae057a5a78f393f4535d9e363dd5efac9d
1836 > 8b058dae057a5a78f393f4535d9e363dd5efac9d f543b27db2cdb41737e2e0008dc524c471da1446
1827 > 8b058dae057a5a78f393f4535d9e363dd5efac9d f543b27db2cdb41737e2e0008dc524c471da1446
1837 > f543b27db2cdb41737e2e0008dc524c471da1446
1828 > f543b27db2cdb41737e2e0008dc524c471da1446
1838 >
1829 >
1839 > nokeep
1830 > nokeep
1840 > :no-active-bookmark
1831 > :no-active-bookmark
1841 > EOF
1832 > EOF
1842 $ echo 1 > a
1833 $ echo 1 > a
1843 $ hg resolve --mark a
1834 $ hg resolve --mark a
1844 (no more unresolved files)
1835 (no more unresolved files)
1845 continue: hg unshelve --continue
1836 continue: hg unshelve --continue
1846 mercurial does not crash
1837 mercurial does not crash
1847 $ hg unshelve --continue
1838 $ hg unshelve --continue
1848 unshelve of 'ashelve' complete
1839 unshelve of 'ashelve' complete
1849
1840
1850 #if phasebased
1841 #if phasebased
1851
1842
1852 Unshelve without .shelve metadata:
1843 Unshelve without .shelve metadata:
1853
1844
1854 $ hg shelve
1845 $ hg shelve
1855 shelved as default
1846 shelved as default
1856 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1857 $ cat .hg/shelved/default.shelve
1848 $ cat .hg/shelved/default.shelve
1858 node=82e0cb9893247d12667017593ce1e5655860f1ac
1849 node=82e0cb9893247d12667017593ce1e5655860f1ac
1859 $ hg strip --hidden --rev 82e0cb989324 --no-backup
1850 $ hg strip --hidden --rev 82e0cb989324 --no-backup
1860 $ rm .hg/shelved/default.shelve
1851 $ rm .hg/shelved/default.shelve
1861 $ echo 3 > a
1852 $ echo 3 > a
1862 $ hg unshelve
1853 $ hg unshelve
1863 unshelving change 'default'
1854 unshelving change 'default'
1864 temporarily committing pending changes (restore with 'hg unshelve --abort')
1855 temporarily committing pending changes (restore with 'hg unshelve --abort')
1865 rebasing shelved changes
1856 rebasing shelved changes
1866 merging a
1857 merging a
1867 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1858 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1868 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1859 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1869 [1]
1860 [1]
1870 $ cat .hg/shelved/default.shelve
1861 $ cat .hg/shelved/default.shelve
1871 node=82e0cb9893247d12667017593ce1e5655860f1ac
1862 node=82e0cb9893247d12667017593ce1e5655860f1ac
1872
1863
1873 #endif
1864 #endif
1874
1865
1875 $ cd ..
1866 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now