Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 10299:e768941f14c1
subrepo: fix errors reported by pylint
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 31 Jan 2010 18:02:16 +0100 |
parents | e898bc7810ad |
children | 55d134ef8ab7 |
comparison
equal
deleted
inserted
replaced
10297:e7727a545c48 | 10299:e768941f14c1 |
---|---|
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> | 3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 import errno, os, re, xml.dom.minidom | 8 import errno, os, re, xml.dom.minidom, shutil |
9 from i18n import _ | 9 from i18n import _ |
10 import config, util, node, error | 10 import config, util, node, error |
11 hg = None | 11 hg = None |
12 | 12 |
13 nullstate = ('', '', 'empty') | 13 nullstate = ('', '', 'empty') |
151 hg = h | 151 hg = h |
152 | 152 |
153 util.path_auditor(ctx._repo.root)(path) | 153 util.path_auditor(ctx._repo.root)(path) |
154 state = ctx.substate.get(path, nullstate) | 154 state = ctx.substate.get(path, nullstate) |
155 if state[2] not in types: | 155 if state[2] not in types: |
156 raise util.Abort(_('unknown subrepo type %s') % t) | 156 raise util.Abort(_('unknown subrepo type %s') % state[2]) |
157 return types[state[2]](ctx, path, state[:2]) | 157 return types[state[2]](ctx, path, state[:2]) |
158 | 158 |
159 # subrepo classes need to implement the following methods: | 159 # subrepo classes need to implement the following methods: |
160 # __init__(self, ctx, path, state) | 160 # __init__(self, ctx, path, state) |
161 # dirty(self): returns true if the dirstate of the subrepo | 161 # dirty(self): returns true if the dirstate of the subrepo |
330 self._ui.status(self._svncommand(['update', '-r', newrev])) | 330 self._ui.status(self._svncommand(['update', '-r', newrev])) |
331 return newrev | 331 return newrev |
332 | 332 |
333 def remove(self): | 333 def remove(self): |
334 if self.dirty(): | 334 if self.dirty(): |
335 self._repo.ui.warn(_('not removing repo %s because ' | 335 self._ui.warn(_('not removing repo %s because ' |
336 'it has changes.\n' % self._path)) | 336 'it has changes.\n' % self._path)) |
337 return | 337 return |
338 self._repo.ui.note('removing subrepo %s\n' % self._path) | 338 self._ui.note('removing subrepo %s\n' % self._path) |
339 shutil.rmtree(self._ctx.repo.join(self._path)) | 339 shutil.rmtree(self._ctx.repo.join(self._path)) |
340 | 340 |
341 def get(self, state): | 341 def get(self, state): |
342 status = self._svncommand(['checkout', state[0], '--revision', state[1]]) | 342 status = self._svncommand(['checkout', state[0], '--revision', state[1]]) |
343 if not re.search('Checked out revision [\d]+.', status): | 343 if not re.search('Checked out revision [\d]+.', status): |