comparison hgext/strip.py @ 42491:1474f5d84662

strip: use bailifchanged() instead of reimplementing it This also means that we get the standard error messages (see changed test cases). Differential Revision: https://phab.mercurial-scm.org/D6535
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 17 Jun 2019 10:19:41 -0700
parents 3a1988e915f9
children 4bcabb5ae9b6
comparison
equal deleted inserted replaced
42490:3a1988e915f9 42491:1474f5d84662
48 48
49 def checklocalchanges(repo, force=False): 49 def checklocalchanges(repo, force=False):
50 cmdutil.checkunfinished(repo) 50 cmdutil.checkunfinished(repo)
51 s = repo.status() 51 s = repo.status()
52 if not force: 52 if not force:
53 if len(repo[None].parents()) > 1: 53 cmdutil.bailifchanged(repo)
54 _("outstanding uncommitted merge") #i18 tool detection
55 raise error.Abort(_("outstanding uncommitted merge"))
56 if s.modified or s.added or s.removed or s.deleted:
57 _("local changes found") # i18n tool detection
58 raise error.Abort(_("local changes found"))
59 if checksubstate(repo):
60 _("local changed subrepos found") # i18n tool detection
61 raise error.Abort(_("local changed subrepos found"))
62 return s 54 return s
63 55
64 def _findupdatetarget(repo, nodes): 56 def _findupdatetarget(repo, nodes):
65 unode, p2 = repo.changelog.parents(nodes[0]) 57 unode, p2 = repo.changelog.parents(nodes[0])
66 currentbranch = repo[None].branch() 58 currentbranch = repo[None].branch()