Mercurial > public > mercurial-scm > python-hglib
comparison hglib/client.py @ 30:b7042bb3dbfd
client: add remove command
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Sun, 14 Aug 2011 00:48:51 +0300 |
parents | c072f525ea3e |
children | ee8863882aae |
comparison
equal
deleted
inserted
replaced
29:c072f525ea3e | 30:b7042bb3dbfd |
---|---|
454 else: | 454 else: |
455 args = cmdbuilder('paths', name) | 455 args = cmdbuilder('paths', name) |
456 out = self.rawcommand(args) | 456 out = self.rawcommand(args) |
457 return out.rstrip() | 457 return out.rstrip() |
458 | 458 |
459 def remove(self, files, after=False, force=False, include=None, exclude=None): | |
460 if not isinstance(files, list): | |
461 files = [files] | |
462 | |
463 args = cmdbuilder('remove', *files, A=after, f=force, I=include, X=exclude) | |
464 | |
465 # we could use Python 3 nonlocal here... | |
466 warnings = [False] | |
467 | |
468 def eh(ret, out, err): | |
469 if ret == 1: | |
470 warnings[0] = True | |
471 else: | |
472 raise error.CommandError(args, ret, out, err) | |
473 | |
474 out = self.rawcommand(args, eh=eh) | |
475 return not warnings[0] | |
476 | |
459 def root(self): | 477 def root(self): |
460 return self.rawcommand(['root']).rstrip() | 478 return self.rawcommand(['root']).rstrip() |
461 | 479 |
462 def status(self): | 480 def status(self): |
463 out = self.rawcommand(['status', '-0']) | 481 out = self.rawcommand(['status', '-0']) |