Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 44317:f546d2170b0f
merge: introduce a clean_update() for that use-case
I find it hard to understand what value to pass for all the arguments
to `merge.update()`. I would like to introduce functions that are more
specific to each use-case. We already have `graft()`. This patch
introduces a `clean_update()` and uses it in some places to show that
it works.
Differential Revision: https://phab.mercurial-scm.org/D7902
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 15 Jan 2020 15:30:25 -0800 |
parents | b1069b369d6e |
children | c791ed6a2154 |
comparison
equal
deleted
inserted
replaced
44316:48a1a974a92c | 44317:f546d2170b0f |
---|---|
2595 b'update', parent1=xp1, parent2=xp2, error=stats.unresolvedcount | 2595 b'update', parent1=xp1, parent2=xp2, error=stats.unresolvedcount |
2596 ) | 2596 ) |
2597 return stats | 2597 return stats |
2598 | 2598 |
2599 | 2599 |
2600 def clean_update(ctx, wc=None): | |
2601 """Do a clean update to the given commit. | |
2602 | |
2603 This involves updating to the commit and discarding any changes in the | |
2604 working copy. | |
2605 """ | |
2606 return update(ctx.repo(), ctx.rev(), branchmerge=False, force=True, wc=wc) | |
2607 | |
2608 | |
2600 def graft( | 2609 def graft( |
2601 repo, | 2610 repo, |
2602 ctx, | 2611 ctx, |
2603 base=None, | 2612 base=None, |
2604 labels=None, | 2613 labels=None, |