##// END OF EJS Templates
unshelve: store information about interactive mode in shelvedstate...
Navaneeth Suresh -
r42889:ee86ad6f default
parent child Browse files
Show More
@@ -177,6 +177,7 b' class shelvedstate(object):'
177 177 _nokeep = 'nokeep'
178 178 # colon is essential to differentiate from a real bookmark name
179 179 _noactivebook = ':no-active-bookmark'
180 _interactive = 'interactive'
180 181
181 182 @classmethod
182 183 def _verifyandtransform(cls, d):
@@ -247,6 +248,7 b' class shelvedstate(object):'
247 248 obj.activebookmark = ''
248 249 if d.get('activebook', '') != cls._noactivebook:
249 250 obj.activebookmark = d.get('activebook', '')
251 obj.interactive = d.get('interactive') == cls._interactive
250 252 except (error.RepoLookupError, KeyError) as err:
251 253 raise error.CorruptedState(pycompat.bytestr(err))
252 254
@@ -254,7 +256,7 b' class shelvedstate(object):'
254 256
255 257 @classmethod
256 258 def save(cls, repo, name, originalwctx, pendingctx, nodestoremove,
257 branchtorestore, keep=False, activebook=''):
259 branchtorestore, keep=False, activebook='', interactive=False):
258 260 info = {
259 261 "name": name,
260 262 "originalwctx": nodemod.hex(originalwctx.node()),
@@ -267,6 +269,8 b' class shelvedstate(object):'
267 269 "keep": cls._keep if keep else cls._nokeep,
268 270 "activebook": activebook or cls._noactivebook
269 271 }
272 if interactive:
273 info['interactive'] = cls._interactive
270 274 scmutil.simplekeyvaluefile(
271 275 repo.vfs, cls._filename).write(info,
272 276 firstline=("%d" % cls._version))
@@ -694,11 +698,12 b' def unshelvecleanup(ui, repo, name, opts'
694 698 if shfile.exists():
695 699 shfile.movetobackup()
696 700 cleanupoldbackups(repo)
697 def unshelvecontinue(ui, repo, state, opts, basename=None):
701 def unshelvecontinue(ui, repo, state, opts):
698 702 """subcommand to continue an in-progress unshelve"""
699 703 # We're finishing off a merge. First parent is our original
700 704 # parent, second is the temporary "fake" commit we're unshelving.
701 interactive = opts.get('interactive')
705 interactive = state.interactive
706 basename = state.name
702 707 with repo.lock():
703 708 checkparents(repo, state)
704 709 ms = merge.mergestate.read(repo)
@@ -869,7 +874,8 b' def _rebaserestoredcommit(ui, repo, opts'
869 874 nodestoremove = [repo.changelog.node(rev)
870 875 for rev in pycompat.xrange(oldtiprev, len(repo))]
871 876 shelvedstate.save(repo, basename, pctx, tmpwctx, nodestoremove,
872 branchtorestore, opts.get('keep'), activebookmark)
877 branchtorestore, opts.get('keep'), activebookmark,
878 interactive)
873 879 raise error.InterventionRequired(
874 880 _("unresolved conflicts (see 'hg resolve', then "
875 881 "'hg unshelve --continue')"))
@@ -936,7 +942,7 b' def dounshelve(ui, repo, *shelved, **opt'
936 942 if opts.get("name"):
937 943 shelved.append(opts["name"])
938 944
939 if abortf or continuef and not interactive:
945 if abortf or continuef:
940 946 if abortf and continuef:
941 947 raise error.Abort(_('cannot use both abort and continue'))
942 948 if shelved:
@@ -958,11 +964,8 b' def dounshelve(ui, repo, *shelved, **opt'
958 964 raise error.Abort(_('no shelved changes to apply!'))
959 965 basename = util.split(shelved[0][1])[1]
960 966 ui.status(_("unshelving change '%s'\n") % basename)
961 elif shelved:
967 else:
962 968 basename = shelved[0]
963 if continuef and interactive:
964 state = _loadshelvedstate(ui, repo, opts)
965 return unshelvecontinue(ui, repo, state, opts, basename)
966 969
967 970 if not shelvedfile(repo, basename, patchextension).exists():
968 971 raise error.Abort(_("shelved change '%s' not found") % basename)
@@ -1351,13 +1351,12 b' Abort unshelve while merging (issue5123)'
1351 1351 A
1352 1352 B
1353 1353 C
1354 $ hg unshelve --continue -i <<EOF
1354 $ hg unshelve --continue <<EOF
1355 1355 > y
1356 1356 > y
1357 1357 > y
1358 1358 > y
1359 1359 > EOF
1360 unshelving change 'default-01'
1361 1360 diff --git a/bar1 b/bar1
1362 1361 1 hunks, 1 lines changed
1363 1362 examine changes to 'bar1'?
General Comments 0
You need to be logged in to leave comments. Login now