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