comparison mercurial/destutil.py @ 26629:ae5f7be2b4ab

destupdate: include the 'check' logic After moving logic from 'merge.update' into 'destutil.destupdate', we are now moving logic from 'command.update' in 'destutil.destupdate'. This will make the function actually useful in predicting (and altering) the update behavior.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 29 Sep 2015 00:18:49 -0700
parents 45b86dbabbda
children 5c57d01fe64e
comparison
equal deleted inserted replaced
26628:45b86dbabbda 26629:ae5f7be2b4ab
9 from . import ( 9 from . import (
10 error, 10 error,
11 obsolete, 11 obsolete,
12 ) 12 )
13 13
14 def destupdate(repo, clean=False): 14 def destupdate(repo, clean=False, check=False):
15 """destination for bare update operation 15 """destination for bare update operation
16 """ 16 """
17 # Here is where we should consider bookmarks, divergent bookmarks, and tip 17 # Here is where we should consider bookmarks, divergent bookmarks, and tip
18 # of current branch; but currently we are only checking the branch tips. 18 # of current branch; but currently we are only checking the branch tips.
19 node = None 19 node = None
69 if dirty: 69 if dirty:
70 msg = _("uncommitted changes") 70 msg = _("uncommitted changes")
71 hint = _("commit and merge, or update --clean to" 71 hint = _("commit and merge, or update --clean to"
72 " discard changes") 72 " discard changes")
73 raise error.Abort(msg, hint=hint) 73 raise error.Abort(msg, hint=hint)
74 else: # destination is not a descendant. 74 elif not check: # destination is not a descendant.
75 msg = _("not a linear update") 75 msg = _("not a linear update")
76 hint = _("merge or update --check to force update") 76 hint = _("merge or update --check to force update")
77 raise error.Abort(msg, hint=hint) 77 raise error.Abort(msg, hint=hint)
78 78
79 return rev 79 return rev