895 :checkout: to which revision the working directory is updated |
895 :checkout: to which revision the working directory is updated |
896 :brev: a name, which might be a bookmark to be activated after updating |
896 :brev: a name, which might be a bookmark to be activated after updating |
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 (None => linear): |
900 Valid values for updatecheck are the UPDATECHECK_* constants |
901 |
901 defined in the merge module. Passing `None` will result in using the |
902 * abort: abort if the working directory is dirty |
902 configured default. |
903 * none: don't check (merge working directory changes into destination) |
903 |
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 changes into destination |
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 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 = 'linear' |
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 |
918 if checkout is None: |
923 if checkout is None: |
919 updata = destutil.destupdate(repo, clean=clean) |
924 updata = destutil.destupdate(repo, clean=clean) |
921 warndest = True |
926 warndest = True |
922 |
927 |
923 if clean: |
928 if clean: |
924 ret = _clean(repo, checkout) |
929 ret = _clean(repo, checkout) |
925 else: |
930 else: |
926 if updatecheck == 'abort': |
931 if updatecheck == mergemod.UPDATECHECK_ABORT: |
927 cmdutil.bailifchanged(repo, merge=False) |
932 cmdutil.bailifchanged(repo, merge=False) |
928 updatecheck = 'none' |
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: |
932 if movemarkfrom == repo['.'].node(): |
937 if movemarkfrom == repo['.'].node(): |
933 pass # no-op update |
938 pass # no-op update |