--- a/mercurial/subrepo.py Mon Oct 05 22:49:24 2015 -0700
+++ b/mercurial/subrepo.py Thu Oct 08 12:55:45 2015 -0700
@@ -95,7 +95,7 @@
return
p.parse(f, data, sections, remap, read)
else:
- raise util.Abort(_("subrepo spec file \'%s\' not found") %
+ raise error.Abort(_("subrepo spec file \'%s\' not found") %
repo.pathto(f))
if '.hgsub' in ctx:
read('.hgsub')
@@ -113,7 +113,7 @@
try:
revision, path = l.split(" ", 1)
except ValueError:
- raise util.Abort(_("invalid subrepository revision "
+ raise error.Abort(_("invalid subrepository revision "
"specifier in \'%s\' line %d")
% (repo.pathto('.hgsubstate'), (i + 1)))
rev[path] = revision
@@ -133,7 +133,7 @@
try:
src = re.sub(pattern, repl, src, 1)
except re.error as e:
- raise util.Abort(_("bad subrepository pattern in %s: %s")
+ raise error.Abort(_("bad subrepository pattern in %s: %s")
% (p.source('subpaths', pattern), e))
return src
@@ -142,7 +142,7 @@
kind = 'hg'
if src.startswith('['):
if ']' not in src:
- raise util.Abort(_('missing ] in subrepo source'))
+ raise error.Abort(_('missing ] in subrepo source'))
kind, src = src.split(']', 1)
kind = kind[1:]
src = src.lstrip() # strip any extra whitespace after ']'
@@ -324,7 +324,7 @@
# chop off the .hg component to get the default path form
return os.path.dirname(repo.sharedpath)
if abort:
- raise util.Abort(_("default path for subrepository not found"))
+ raise error.Abort(_("default path for subrepository not found"))
def _sanitize(ui, vfs, ignore):
for dirname, dirs, names in vfs.walk():
@@ -353,7 +353,7 @@
pathutil.pathauditor(ctx.repo().root)(path)
state = ctx.substate[path]
if state[2] not in types:
- raise util.Abort(_('unknown subrepo type %s') % state[2])
+ raise error.Abort(_('unknown subrepo type %s') % state[2])
if allowwdir:
state = (state[0], ctx.subrev(path), state[2])
return types[state[2]](ctx, path, state[:2])
@@ -371,7 +371,7 @@
pathutil.pathauditor(ctx.repo().root)(path)
state = ctx.substate[path]
if state[2] not in types:
- raise util.Abort(_('unknown subrepo type %s') % state[2])
+ raise error.Abort(_('unknown subrepo type %s') % state[2])
subrev = ''
if state[2] == 'hg':
subrev = "0" * 40
@@ -384,7 +384,7 @@
return commitphase
check = ui.config('phases', 'checksubrepos', 'follow')
if check not in ('ignore', 'follow', 'abort'):
- raise util.Abort(_('invalid phases.checksubrepos configuration: %s')
+ raise error.Abort(_('invalid phases.checksubrepos configuration: %s')
% (check))
if check == 'ignore':
return commitphase
@@ -398,7 +398,7 @@
maxsub = s
if commitphase < maxphase:
if check == 'abort':
- raise util.Abort(_("can't commit in %s phase"
+ raise error.Abort(_("can't commit in %s phase"
" conflicting %s from subrepository %s") %
(phases.phasenames[commitphase],
phases.phasenames[maxphase], maxsub))
@@ -456,7 +456,7 @@
"""
dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate)
if dirtyreason:
- raise util.Abort(dirtyreason)
+ raise error.Abort(dirtyreason)
def basestate(self):
"""current working directory base state, disregarding .hgsubstate
@@ -1073,7 +1073,7 @@
self._state = state
self._exe = util.findexe('svn')
if not self._exe:
- raise util.Abort(_("'svn' executable not found for subrepo '%s'")
+ raise error.Abort(_("'svn' executable not found for subrepo '%s'")
% self._path)
def _svncommand(self, commands, filename='', failok=False):
@@ -1108,7 +1108,8 @@
stderr = stderr.strip()
if not failok:
if p.returncode:
- raise util.Abort(stderr or 'exited with code %d' % p.returncode)
+ raise error.Abort(stderr or 'exited with code %d'
+ % p.returncode)
if stderr:
self.ui.warn(stderr + '\n')
return stdout, stderr
@@ -1118,7 +1119,7 @@
output, err = self._svncommand(['--version', '--quiet'], filename=None)
m = re.search(r'^(\d+)\.(\d+)', output)
if not m:
- raise util.Abort(_('cannot retrieve svn tool version'))
+ raise error.Abort(_('cannot retrieve svn tool version'))
return (int(m.group(1)), int(m.group(2)))
def _wcrevs(self):
@@ -1196,11 +1197,11 @@
return self.basestate()
if extchanged:
# Do not try to commit externals
- raise util.Abort(_('cannot commit svn externals'))
+ raise error.Abort(_('cannot commit svn externals'))
if missing:
# svn can commit with missing entries but aborting like hg
# seems a better approach.
- raise util.Abort(_('cannot commit missing svn entries'))
+ raise error.Abort(_('cannot commit missing svn entries'))
commitinfo, err = self._svncommand(['commit', '-m', text])
self.ui.status(commitinfo)
newrev = re.search('Committed revision ([0-9]+).', commitinfo)
@@ -1210,8 +1211,8 @@
# svn one. For instance, svn ignores missing files
# when committing. If there are only missing files, no
# commit is made, no output and no error code.
- raise util.Abort(_('failed to commit svn changes'))
- raise util.Abort(commitinfo.splitlines()[-1])
+ raise error.Abort(_('failed to commit svn changes'))
+ raise error.Abort(commitinfo.splitlines()[-1])
newrev = newrev.groups()[0]
self.ui.status(self._svncommand(['update', '-r', newrev])[0])
return newrev
@@ -1250,7 +1251,7 @@
self.remove()
self.get(state, overwrite=False)
return
- raise util.Abort((status or err).splitlines()[-1])
+ raise error.Abort((status or err).splitlines()[-1])
self.ui.status(status)
@annotatesubrepoerror
@@ -1307,7 +1308,7 @@
if versionstatus == 'unknown':
self.ui.warn(_('cannot retrieve git version\n'))
elif versionstatus == 'abort':
- raise util.Abort(_('git subrepo requires at least 1.6.0 or later'))
+ raise error.Abort(_('git subrepo requires at least 1.6.0 or later'))
elif versionstatus == 'warning':
self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n'))
@@ -1394,7 +1395,7 @@
if command in ('cat-file', 'symbolic-ref'):
return retdata, p.returncode
# for all others, abort
- raise util.Abort('git %s error %d in %s' %
+ raise error.Abort('git %s error %d in %s' %
(command, p.returncode, self._relpath))
return retdata, p.returncode
@@ -1491,7 +1492,7 @@
# try only origin: the originally cloned repo
self._gitcommand(['fetch'])
if not self._githavelocally(revision):
- raise util.Abort(_("revision %s does not exist in subrepo %s\n") %
+ raise error.Abort(_("revision %s does not exist in subrepo %s\n") %
(revision, self._relpath))
@annotatesubrepoerror
@@ -1600,7 +1601,7 @@
@annotatesubrepoerror
def commit(self, text, user, date):
if self._gitmissing():
- raise util.Abort(_("subrepo %s is missing") % self._relpath)
+ raise error.Abort(_("subrepo %s is missing") % self._relpath)
cmd = ['commit', '-a', '-m', text]
env = os.environ.copy()
if user:
@@ -1646,7 +1647,7 @@
if not self._state[1]:
return True
if self._gitmissing():
- raise util.Abort(_("subrepo %s is missing") % self._relpath)
+ raise error.Abort(_("subrepo %s is missing") % self._relpath)
# if a branch in origin contains the revision, nothing to do
branch2rev, rev2branch = self._gitbranchmap()
if self._state[1] in rev2branch: