src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py

branch
eric7
changeset 10215
d476667171a1
parent 10214
de0718b80010
child 10372
1444b4bee64b
equal deleted inserted replaced
10214:de0718b80010 10215:d476667171a1
1427 else: 1427 else:
1428 if tagsList: 1428 if tagsList:
1429 self.tagsList = tagsList 1429 self.tagsList = tagsList
1430 return self.tagsList[:] 1430 return self.tagsList[:]
1431 1431
1432 def hgGetBranchesList(self): 1432 def hgGetBranchesList(self, withState=False, withDefault=False):
1433 """ 1433 """
1434 Public method to get the list of branches. 1434 Public method to get the list of branches.
1435 1435
1436 @return list of branches (list of string) 1436 @param withState flag indicating to include a state indication (defaults to
1437 False)
1438 @type bool (optional)
1439 @param withDefault flag indicating to include the 'default' branch, if that
1440 is present (defaults to False)
1441 @type bool (optional)
1442 @return list of branches with optional state indication ('' for an active
1443 branch, 'C' for a closed branch or 'I' for an inactive branch)
1444 @rtype list of str or list of tuple of (str, str)
1437 """ 1445 """
1438 args = self.initCommand("branches") 1446 args = self.initCommand("branches")
1439 args.append("--closed") 1447 args.append("--closed")
1440 1448
1441 output, error = self.__client.runcommand(args) 1449 output, error = self.__client.runcommand(args)
1445 for line in output.splitlines(): 1453 for line in output.splitlines():
1446 li = line.strip().split() 1454 li = line.strip().split()
1447 if li[-1][0] in "1234567890": 1455 if li[-1][0] in "1234567890":
1448 # last element is a rev:changeset 1456 # last element is a rev:changeset
1449 del li[-1] 1457 del li[-1]
1458 state = ""
1450 else: 1459 else:
1460 state = "C" if li[-1] == "(closed)" else "I"
1451 del li[-2:] 1461 del li[-2:]
1452 name = " ".join(li) 1462 name = " ".join(li)
1453 if name not in ["tip", "default"]: 1463 if name not in ["tip", "default"] or (
1454 self.branchesList.append(name) 1464 name == "default" and withDefault
1465 ):
1466 if withState:
1467 self.branchesList.append((name, state))
1468 else:
1469 self.branchesList.append(name)
1455 1470
1456 return self.branchesList[:] 1471 return self.branchesList[:]
1457 1472
1458 def hgListTagBranch(self, tags=True): 1473 def hgListTagBranch(self, tags=True):
1459 """ 1474 """

eric ide

mercurial