##// END OF EJS Templates
merge: replace magic strings with NAMED_CONSTANTS (API)...
Augie Fackler -
r43240:1ad3ebb3 default
parent child Browse files
Show More
@@ -897,21 +897,26 b' def updatetotally(ui, repo, checkout, br'
897 897 :clean: whether changes in the working directory can be discarded
898 898 :updatecheck: how to deal with a dirty working directory
899 899
900 Valid values for updatecheck are (None => linear):
900 Valid values for updatecheck are the UPDATECHECK_* constants
901 defined in the merge module. Passing `None` will result in using the
902 configured default.
901 903
902 * abort: abort if the working directory is dirty
903 * none: don't check (merge working directory changes into destination)
904 * linear: check that update is linear before merging working directory
904 * ABORT: abort if the working directory is dirty
905 * NONE: don't check (merge working directory changes into destination)
906 * LINEAR: check that update is linear before merging working directory
905 907 changes into destination
906 * noconflict: check that the update does not result in file merges
908 * NO_CONFLICT: check that the update does not result in file merges
907 909
908 910 This returns whether conflict is detected at updating or not.
909 911 """
910 912 if updatecheck is None:
911 913 updatecheck = ui.config('commands', 'update.check')
912 if updatecheck not in ('abort', 'none', 'linear', 'noconflict'):
914 if updatecheck not in (mergemod.UPDATECHECK_ABORT,
915 mergemod.UPDATECHECK_NONE,
916 mergemod.UPDATECHECK_LINEAR,
917 mergemod.UPDATECHECK_NO_CONFLICT):
913 918 # If not configured, or invalid value configured
914 updatecheck = 'linear'
919 updatecheck = mergemod.UPDATECHECK_LINEAR
915 920 with repo.wlock():
916 921 movemarkfrom = None
917 922 warndest = False
@@ -923,9 +928,9 b' def updatetotally(ui, repo, checkout, br'
923 928 if clean:
924 929 ret = _clean(repo, checkout)
925 930 else:
926 if updatecheck == 'abort':
931 if updatecheck == mergemod.UPDATECHECK_ABORT:
927 932 cmdutil.bailifchanged(repo, merge=False)
928 updatecheck = 'none'
933 updatecheck = mergemod.UPDATECHECK_NONE
929 934 ret = _update(repo, checkout, updatecheck=updatecheck)
930 935
931 936 if not ret and movemarkfrom:
@@ -1926,6 +1926,11 b' def recordupdates(repo, actions, branchm'
1926 1926 else:
1927 1927 repo.dirstate.normal(f)
1928 1928
1929 UPDATECHECK_ABORT = 'abort' # handled at higher layers
1930 UPDATECHECK_NONE = 'none'
1931 UPDATECHECK_LINEAR = 'linear'
1932 UPDATECHECK_NO_CONFLICT = 'noconflict'
1933
1929 1934 def update(repo, node, branchmerge, force, ancestor=None,
1930 1935 mergeancestor=False, labels=None, matcher=None, mergeforce=False,
1931 1936 updatecheck=None, wc=None):
@@ -1992,8 +1997,11 b' def update(repo, node, branchmerge, forc'
1992 1997 # and force=False pass a value for updatecheck. We may want to allow
1993 1998 # updatecheck='abort' to better suppport some of these callers.
1994 1999 if updatecheck is None:
1995 updatecheck = 'linear'
1996 assert updatecheck in ('none', 'linear', 'noconflict')
2000 updatecheck = UPDATECHECK_LINEAR
2001 assert updatecheck in (UPDATECHECK_NONE,
2002 UPDATECHECK_LINEAR,
2003 UPDATECHECK_NO_CONFLICT,
2004 )
1997 2005 # If we're doing a partial update, we need to skip updating
1998 2006 # the dirstate, so make a note of any partial-ness to the
1999 2007 # update here.
@@ -2050,7 +2058,7 b' def update(repo, node, branchmerge, forc'
2050 2058 repo.hook('update', parent1=xp2, parent2='', error=0)
2051 2059 return updateresult(0, 0, 0, 0)
2052 2060
2053 if (updatecheck == 'linear' and
2061 if (updatecheck == UPDATECHECK_LINEAR and
2054 2062 pas not in ([p1], [p2])): # nonlinear
2055 2063 dirty = wc.dirty(missing=True)
2056 2064 if dirty:
@@ -2087,7 +2095,7 b' def update(repo, node, branchmerge, forc'
2087 2095 repo, wc, p2, pas, branchmerge, force, mergeancestor,
2088 2096 followcopies, matcher=matcher, mergeforce=mergeforce)
2089 2097
2090 if updatecheck == 'noconflict':
2098 if updatecheck == UPDATECHECK_NO_CONFLICT:
2091 2099 for f, (m, args, msg) in actionbyfile.iteritems():
2092 2100 if m not in (ACTION_GET, ACTION_KEEP, ACTION_EXEC,
2093 2101 ACTION_REMOVE, ACTION_PATH_CONFLICT_RESOLVE):
General Comments 0
You need to be logged in to leave comments. Login now