comparison hglib/client.py @ 125:8d9a9da3e7b4

client: add 'phase' method to set or get the phase of a changeset
author Paul Tonelli <paul.tonelli@logilab.fr>
date Fri, 16 May 2014 18:21:12 +0200
parents cdde1656346f
children 53387d1e620b
comparison
equal deleted inserted replaced
124:cc7569bffb26 125:8d9a9da3e7b4
1402 line = line[:-6] 1402 line = line[:-6]
1403 name, rev = line.rsplit(' ', 1) 1403 name, rev = line.rsplit(' ', 1)
1404 rev, node = rev.split(':') 1404 rev, node = rev.split(':')
1405 t.append((name.rstrip(), int(rev), node, taglocal)) 1405 t.append((name.rstrip(), int(rev), node, taglocal))
1406 return t 1406 return t
1407
1408 def phase(self, revs=(), secret=False, draft=False, public=False,
1409 force=False):
1410 '''Set or show the current phase name.
1411
1412 revs - target revision(s)
1413 public - set changeset phase to public
1414 draft - set changeset phase to draft
1415 secret - set changeset phase to secret
1416 force - allow to move boundary backward
1417
1418 output format: [(id, phase) ...] for each changeset
1419
1420 The arguments match the mercurial API.
1421 '''
1422 if not isinstance(revs, (list, tuple)):
1423 revs = [revs]
1424 args = util.cmdbuilder('phase', secret=secret, draft=draft,
1425 public=public, force=force, hidden=self.hidden, *revs)
1426 out = self.rawcommand(args)
1427 if draft or public or secret:
1428 return
1429 else:
1430 output = [i.split(': ')for i in out.strip().split('\n')]
1431 return [(int(num), phase) for (num, phase) in output]
1407 1432
1408 def summary(self, remote=False): 1433 def summary(self, remote=False):
1409 """ 1434 """
1410 Return a dictionary with a brief summary of the working directory state, 1435 Return a dictionary with a brief summary of the working directory state,
1411 including parents, branch, commit status, and available updates. 1436 including parents, branch, commit status, and available updates.