##// END OF EJS Templates
merge: disallow merge abort in case of an unfinished operation (issue6160)...
Taapas Agrawal -
r42780:b8d54f46 default
parent child Browse files
Show More
@@ -3297,6 +3297,14 b' def clearunfinished(repo):'
3297 if s._clearable and s.isunfinished(repo):
3297 if s._clearable and s.isunfinished(repo):
3298 util.unlink(repo.vfs.join(s._fname))
3298 util.unlink(repo.vfs.join(s._fname))
3299
3299
3300 def getunfinishedstate(repo):
3301 ''' Checks for unfinished operations and returns statecheck object
3302 for it'''
3303 for state in statemod._unfinishedstates:
3304 if state.isunfinished(repo):
3305 return state
3306 return None
3307
3300 def howtocontinue(repo):
3308 def howtocontinue(repo):
3301 '''Check for an unfinished operation and return the command to finish
3309 '''Check for an unfinished operation and return the command to finish
3302 it.
3310 it.
@@ -3952,6 +3952,10 b' def merge(ui, repo, node=None, **opts):'
3952 if abort and repo.dirstate.p2() == nullid:
3952 if abort and repo.dirstate.p2() == nullid:
3953 cmdutil.wrongtooltocontinue(repo, _('merge'))
3953 cmdutil.wrongtooltocontinue(repo, _('merge'))
3954 if abort:
3954 if abort:
3955 state = cmdutil.getunfinishedstate(repo)
3956 if state and state._opname != 'merge':
3957 raise error.Abort(_('cannot abort merge with %s in progress') %
3958 (state._opname), hint=state.hint())
3955 if node:
3959 if node:
3956 raise error.Abort(_("cannot specify a node with --abort"))
3960 raise error.Abort(_("cannot specify a node with --abort"))
3957 if opts.get('rev'):
3961 if opts.get('rev'):
@@ -81,6 +81,10 b''
81
81
82 * `cmdutil.checkunfinished()` now includes detection for merge too.
82 * `cmdutil.checkunfinished()` now includes detection for merge too.
83
83
84 * merge abort has been disallowed in case an operation of higher
85 precedence is in progress to avoid cases of partial abort of
86 operations.
87
84 * We used to automatically attempt to make extensions compatible with
88 * We used to automatically attempt to make extensions compatible with
85 Python 3 (by translating their source code while loading it). We no
89 Python 3 (by translating their source code while loading it). We no
86 longer do that.
90 longer do that.
@@ -847,3 +847,38 b' Unshelve without .shelve metadata (can h'
847 #endif
847 #endif
848
848
849 $ cd ..
849 $ cd ..
850
851 Block merge abort when unshelve in progress(issue6160)
852 ------------------------------------------------------
853
854 $ hg init a
855 $ cd a
856 $ echo foo > a ; hg commit -qAm "initial commit"
857 $ echo bar > a
858 $ hg shelve
859 shelved as default
860 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
861 $ echo foobar > a
862 $ hg unshelve
863 unshelving change 'default'
864 temporarily committing pending changes (restore with 'hg unshelve --abort')
865 rebasing shelved changes
866 merging a
867 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
868 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
869 [1]
870
871 $ hg log --template '{desc|firstline} {author} {date|isodate} \n' -r .
872 pending changes temporary commit shelve@localhost 1970-01-01 00:00 +0000
873 $ hg merge --abort
874 abort: cannot abort merge with unshelve in progress
875 (use 'hg unshelve --continue' or 'hg unshelve --abort')
876 [255]
877
878 $ hg unshelve --abort
879 unshelve of 'default' aborted
880
881 $ hg log -G --template '{desc|firstline} {author} {date|isodate} \n' -r .
882 @ initial commit test 1970-01-01 00:00 +0000
883
884 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now