comparison mercurial/localrepo.py @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents 8f2ff40fe9c9
children e077ce385609
comparison
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
638 date: date tuple to use if committing''' 638 date: date tuple to use if committing'''
639 639
640 if not local: 640 if not local:
641 m = matchmod.exact(self.root, '', ['.hgtags']) 641 m = matchmod.exact(self.root, '', ['.hgtags'])
642 if any(self.status(match=m, unknown=True, ignored=True)): 642 if any(self.status(match=m, unknown=True, ignored=True)):
643 raise util.Abort(_('working copy of .hgtags is changed'), 643 raise error.Abort(_('working copy of .hgtags is changed'),
644 hint=_('please commit .hgtags manually')) 644 hint=_('please commit .hgtags manually'))
645 645
646 self.tags() # instantiate the cache 646 self.tags() # instantiate the cache
647 self._tag(names, node, message, local, user, date, editor=editor) 647 self._tag(names, node, message, local, user, date, editor=editor)
648 648
1117 except IOError: 1117 except IOError:
1118 msg = _('rolling back unknown transaction\n') 1118 msg = _('rolling back unknown transaction\n')
1119 desc = None 1119 desc = None
1120 1120
1121 if not force and self['.'] != self['tip'] and desc == 'commit': 1121 if not force and self['.'] != self['tip'] and desc == 'commit':
1122 raise util.Abort( 1122 raise error.Abort(
1123 _('rollback of last commit while not checked out ' 1123 _('rollback of last commit while not checked out '
1124 'may lose data'), hint=_('use -f to force')) 1124 'may lose data'), hint=_('use -f to force'))
1125 1125
1126 ui.status(msg) 1126 ui.status(msg)
1127 if dryrun: 1127 if dryrun:
1431 """ 1431 """
1432 if extra is None: 1432 if extra is None:
1433 extra = {} 1433 extra = {}
1434 1434
1435 def fail(f, msg): 1435 def fail(f, msg):
1436 raise util.Abort('%s: %s' % (f, msg)) 1436 raise error.Abort('%s: %s' % (f, msg))
1437 1437
1438 if not match: 1438 if not match:
1439 match = matchmod.always(self.root, '') 1439 match = matchmod.always(self.root, '')
1440 1440
1441 if not force: 1441 if not force:
1447 try: 1447 try:
1448 wctx = self[None] 1448 wctx = self[None]
1449 merge = len(wctx.parents()) > 1 1449 merge = len(wctx.parents()) > 1
1450 1450
1451 if not force and merge and match.ispartial(): 1451 if not force and merge and match.ispartial():
1452 raise util.Abort(_('cannot partially commit a merge ' 1452 raise error.Abort(_('cannot partially commit a merge '
1453 '(do not specify files or patterns)')) 1453 '(do not specify files or patterns)'))
1454 1454
1455 status = self.status(match=match, clean=force) 1455 status = self.status(match=match, clean=force)
1456 if force: 1456 if force:
1457 status.modified.extend(status.clean) # mq may commit clean files 1457 status.modified.extend(status.clean) # mq may commit clean files
1475 # ignore working copy, use old state if present 1475 # ignore working copy, use old state if present
1476 if s in oldstate: 1476 if s in oldstate:
1477 newstate[s] = oldstate[s] 1477 newstate[s] = oldstate[s]
1478 continue 1478 continue
1479 if not force: 1479 if not force:
1480 raise util.Abort( 1480 raise error.Abort(
1481 _("commit with new subrepo %s excluded") % s) 1481 _("commit with new subrepo %s excluded") % s)
1482 dirtyreason = wctx.sub(s).dirtyreason(True) 1482 dirtyreason = wctx.sub(s).dirtyreason(True)
1483 if dirtyreason: 1483 if dirtyreason:
1484 if not self.ui.configbool('ui', 'commitsubrepos'): 1484 if not self.ui.configbool('ui', 'commitsubrepos'):
1485 raise util.Abort(dirtyreason, 1485 raise error.Abort(dirtyreason,
1486 hint=_("use --subrepos for recursive commit")) 1486 hint=_("use --subrepos for recursive commit"))
1487 subs.append(s) 1487 subs.append(s)
1488 commitsubs.add(s) 1488 commitsubs.add(s)
1489 else: 1489 else:
1490 bs = wctx.sub(s).basestate() 1490 bs = wctx.sub(s).basestate()
1497 r = [s for s in p.substate if s not in newstate] 1497 r = [s for s in p.substate if s not in newstate]
1498 subs += [s for s in r if match(s)] 1498 subs += [s for s in r if match(s)]
1499 if subs: 1499 if subs:
1500 if (not match('.hgsub') and 1500 if (not match('.hgsub') and
1501 '.hgsub' in (wctx.modified() + wctx.added())): 1501 '.hgsub' in (wctx.modified() + wctx.added())):
1502 raise util.Abort( 1502 raise error.Abort(
1503 _("can't commit subrepos without .hgsub")) 1503 _("can't commit subrepos without .hgsub"))
1504 status.modified.insert(0, '.hgsubstate') 1504 status.modified.insert(0, '.hgsubstate')
1505 1505
1506 elif '.hgsub' in status.removed: 1506 elif '.hgsub' in status.removed:
1507 # clean up .hgsubstate when .hgsub is removed 1507 # clean up .hgsubstate when .hgsub is removed
1539 or self.ui.configbool('ui', 'allowemptycommit')) 1539 or self.ui.configbool('ui', 'allowemptycommit'))
1540 if not allowemptycommit: 1540 if not allowemptycommit:
1541 return None 1541 return None
1542 1542
1543 if merge and cctx.deleted(): 1543 if merge and cctx.deleted():
1544 raise util.Abort(_("cannot commit merge with missing files")) 1544 raise error.Abort(_("cannot commit merge with missing files"))
1545 1545
1546 ms = mergemod.mergestate(self) 1546 ms = mergemod.mergestate(self)
1547 for f in status.modified: 1547 for f in status.modified:
1548 if f in ms and ms[f] == 'u': 1548 if f in ms and ms[f] == 'u':
1549 raise util.Abort(_('unresolved merge conflicts ' 1549 raise error.Abort(_('unresolved merge conflicts '
1550 '(see "hg help resolve")')) 1550 '(see "hg help resolve")'))
1551 1551
1552 if editor: 1552 if editor:
1553 cctx._text = editor(self, cctx, subs) 1553 cctx._text = editor(self, cctx, subs)
1554 edited = (text != cctx._text) 1554 edited = (text != cctx._text)