comparison hglib/client.py @ 20:6a9d16ddae31

client: add update command
author Idan Kamara <idankk86@gmail.com>
date Thu, 11 Aug 2011 15:42:59 +0300
parents 518149e32888
children ffef7df076e8
comparison
equal deleted inserted replaced
19:19d2c55c3928 20:6a9d16ddae31
339 out = self.rawcommand(args) 339 out = self.rawcommand(args)
340 out = out.split('\0') 340 out = out.split('\0')
341 341
342 return self._parserevs(out)[0] 342 return self._parserevs(out)[0]
343 343
344 def update(self, rev=None, clean=False, check=False, date=None):
345 """
346 Update the repository's working directory to changeset specified by rev.
347 If rev isn't specified, update to the tip of the current named branch.
348
349 Return the number of files (updated, merged, removed, unresolved)
350 """
351 if clean and check:
352 raise ValueError('clean and check cannot both be True')
353
354 args = cmdbuilder('update', r=rev, C=clean, c=check, d=date)
355
356 def eh(ret, out, err):
357 if ret == 1:
358 return out
359
360 raise error.CommandError(args, ret, out, err)
361
362
363 out = self.rawcommand(args, eh=eh)
364
365 # filter out 'merging ...' lines
366 out = util.skiplines(out, 'merging ')
367
368 counters = out.rstrip().split(', ')
369 return tuple(int(s.split(' ', 1)[0]) for s in counters)