Mercurial > python-hglib
diff hglib/client.py @ 32:a2fc0a7f648e
client: add move command
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Sun, 14 Aug 2011 00:49:28 +0300 |
parents | ee8863882aae |
children | d74a5891d9d1 |
line wrap: on
line diff
--- a/hglib/client.py Sun Aug 14 00:49:15 2011 +0300 +++ b/hglib/client.py Sun Aug 14 00:49:28 2011 +0300 @@ -417,6 +417,27 @@ return self._parserevs(out) + def move(self, source, dest, after=False, force=False, dryrun=False, + include=None, exclude=None): + if not isinstance(source, list): + source = [source] + + source.append(dest) + args = cmdbuilder('move', *source, A=after, f=force, n=dryrun, + I=include, X=exclude) + + # we could use Python 3 nonlocal here... + warnings = [False] + + def eh(ret, out, err): + if ret == 1: + warnings[0] = True + else: + raise error.CommandError(args, ret, out, err) + + self.rawcommand(args, eh=eh) + return not warnings[0] + def outgoing(self, revrange=None, path=None, force=False, newest=False, bookmarks=False, branch=None, limit=None, nomerges=False, subrepos=False):