# HG changeset patch # User Idan Kamara # Date 1313673604 -10800 # Node ID 82d927ac1329a30098f17503e6b68267dc89eeda # Parent 94d2988e55b755529aa66d48c5853f9b2671a8c4 client: add addremove command diff -r 94d2988e55b7 -r 82d927ac1329 hglib/client.py --- a/hglib/client.py Thu Aug 18 14:29:29 2011 +0300 +++ b/hglib/client.py Thu Aug 18 16:20:04 2011 +0300 @@ -167,6 +167,26 @@ self.rawcommand(args, eh=eh) return not warnings[0] + def addremove(self, files=[], similarity=None, dryrun=False, include=None, + exclude=None): + if not isinstance(files, list): + files = [files] + + args = cmdbuilder('addremove', *files, s=similarity, 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 backout(self, rev, merge=False, parent=None, tool=None, message=None, logfile=None, date=None, user=None): if message and logfile: