comparison hglib/client.py @ 29:c072f525ea3e

client: add copy command
author Idan Kamara <idankk86@gmail.com>
date Sun, 14 Aug 2011 00:48:40 +0300
parents 221eeb3693f4
children b7042bb3dbfd
comparison
equal deleted inserted replaced
28:221eeb3693f4 29:c072f525ea3e
299 self.server.stdin.write('getencoding\n') 299 self.server.stdin.write('getencoding\n')
300 self._encoding = self._readfromchannel('r') 300 self._encoding = self._readfromchannel('r')
301 301
302 return self._encoding 302 return self._encoding
303 303
304 def copy(self, source, dest, after=False, force=False, dryrun=False,
305 include=None, exclude=None):
306 if not isinstance(source, list):
307 source = [source]
308
309 source.append(dest)
310 args = cmdbuilder('copy', *source, A=after, f=force, n=dryrun,
311 I=include, X=exclude)
312
313 # we could use Python 3 nonlocal here...
314 warnings = [False]
315
316 def eh(ret, out, err):
317 if ret == 1:
318 warnings[0] = True
319 else:
320 raise error.CommandError(args, ret, out, err)
321
322 self.rawcommand(args, eh=eh)
323 return not warnings[0]
324
304 def import_(self, patches, strip=None, force=False, nocommit=False, 325 def import_(self, patches, strip=None, force=False, nocommit=False,
305 bypass=False, exact=False, importbranch=False, message=None, 326 bypass=False, exact=False, importbranch=False, message=None,
306 date=None, user=None, similarity=None): 327 date=None, user=None, similarity=None):
307 """ 328 """
308 patches can be a list of file names with patches to apply 329 patches can be a list of file names with patches to apply