comparison mercurial/merge.py @ 45576:c1b603cdc95a

merge: add a higher-level update() for the common `hg update` use case This is different from the `update()` function that I just made private. The new function is specifically for the normal `hg update` use case. It doesn't do a merge and it doesn't do a clean (forced) update. Differential Revision: https://phab.mercurial-scm.org/D9066
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 21 Sep 2020 09:57:29 -0700
parents 2c86b9587740
children 76d79b80d953
comparison
equal deleted inserted replaced
45575:147fb889278b 45576:c1b603cdc95a
2054 mergeforce=force, 2054 mergeforce=force,
2055 wc=wc, 2055 wc=wc,
2056 ) 2056 )
2057 2057
2058 2058
2059 def update(ctx, updatecheck=None, wc=None):
2060 """Do a regular update to the given commit, aborting if there are conflicts.
2061
2062 The 'updatecheck' argument can be used to control what to do in case of
2063 conflicts.
2064
2065 Note: This is a new, higher-level update() than the one that used to exist
2066 in this module. That function is now called _update(). You can hopefully
2067 replace your callers to use this new update(), or clean_update(), merge(),
2068 revert_to(), or graft().
2069 """
2070 return _update(
2071 ctx.repo(),
2072 ctx.rev(),
2073 branchmerge=False,
2074 force=False,
2075 labels=[b'working copy', b'destination'],
2076 updatecheck=updatecheck,
2077 wc=wc,
2078 )
2079
2080
2059 def clean_update(ctx, wc=None): 2081 def clean_update(ctx, wc=None):
2060 """Do a clean update to the given commit. 2082 """Do a clean update to the given commit.
2061 2083
2062 This involves updating to the commit and discarding any changes in the 2084 This involves updating to the commit and discarding any changes in the
2063 working copy. 2085 working copy.