comparison mercurial/cmdutil.py @ 44271:c791ed6a2154

merge: introduce a revert_to() for that use-case In the same vein as the previous patch. Differential Revision: https://phab.mercurial-scm.org/D7901
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 15 Jan 2020 14:47:38 -0800
parents d4c1501225c4
children 142d2a4cb69a
comparison
equal deleted inserted replaced
44270:f546d2170b0f 44271:c791ed6a2154
582 fp.seek(0) 582 fp.seek(0)
583 583
584 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles] 584 [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles]
585 # 3a. apply filtered patch to clean repo (clean) 585 # 3a. apply filtered patch to clean repo (clean)
586 if backups: 586 if backups:
587 # Equivalent to hg.revert
588 m = scmutil.matchfiles(repo, set(backups.keys()) | alsorestore) 587 m = scmutil.matchfiles(repo, set(backups.keys()) | alsorestore)
589 mergemod.update( 588 mergemod.revert_to(repo[b'.'], matcher=m)
590 repo,
591 repo.dirstate.p1(),
592 branchmerge=False,
593 force=True,
594 matcher=m,
595 )
596 589
597 # 3b. (apply) 590 # 3b. (apply)
598 if dopatch: 591 if dopatch:
599 try: 592 try:
600 ui.debug(b'applying patch\n') 593 ui.debug(b'applying patch\n')