comparison hglib/client.py @ 28:221eeb3693f4

client: add add command
author Idan Kamara <idankk86@gmail.com>
date Sun, 14 Aug 2011 00:48:19 +0300
parents 46908f4b87d5
children c072f525ea3e
comparison
equal deleted inserted replaced
27:46908f4b87d5 28:221eeb3693f4
138 self.server.wait() 138 self.server.wait()
139 ret = self.server.returncode 139 ret = self.server.returncode
140 self.server = None 140 self.server = None
141 return ret 141 return ret
142 142
143 def add(self, files=[], dryrun=False, subrepos=False, include=None,
144 exclude=None):
145 """
146 Add the specified files on the next commit.
147 If no files are given, add all files to the repository.
148
149 Return whether all given files were added.
150 """
151 if not isinstance(files, list):
152 files = [files]
153
154 args = cmdbuilder('add', *files, n=dryrun, S=subrepos, I=include, X=exclude)
155
156 # we could use Python 3 nonlocal here...
157 warnings = [False]
158
159 def eh(ret, out, err):
160 if ret == 1:
161 warnings[0] = True
162 else:
163 raise error.CommandError(args, ret, out, err)
164
165 self.rawcommand(args, eh=eh)
166 return not warnings[0]
167
143 def backout(self, rev, merge=False, parent=None, tool=None, message=None, 168 def backout(self, rev, merge=False, parent=None, tool=None, message=None,
144 logfile=None, date=None, user=None): 169 logfile=None, date=None, user=None):
145 if message and logfile: 170 if message and logfile:
146 raise ValueError("cannot specify both a message and a logfile") 171 raise ValueError("cannot specify both a message and a logfile")
147 172