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