--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Mon Sep 25 12:09:23 2023 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Tue Sep 26 18:26:21 2023 +0200 @@ -1429,11 +1429,19 @@ self.tagsList = tagsList return self.tagsList[:] - def hgGetBranchesList(self): + def hgGetBranchesList(self, withState=False, withDefault=False): """ Public method to get the list of branches. - @return list of branches (list of string) + @param withState flag indicating to include a state indication (defaults to + False) + @type bool (optional) + @param withDefault flag indicating to include the 'default' branch, if that + is present (defaults to False) + @type bool (optional) + @return list of branches with optional state indication ('' for an active + branch, 'C' for a closed branch or 'I' for an inactive branch) + @rtype list of str or list of tuple of (str, str) """ args = self.initCommand("branches") args.append("--closed") @@ -1447,11 +1455,18 @@ if li[-1][0] in "1234567890": # last element is a rev:changeset del li[-1] + state = "" else: + state = "C" if li[-1] == "(closed)" else "I" del li[-2:] name = " ".join(li) - if name not in ["tip", "default"]: - self.branchesList.append(name) + if name not in ["tip", "default"] or ( + name == "default" and withDefault + ): + if withState: + self.branchesList.append((name, state)) + else: + self.branchesList.append(name) return self.branchesList[:]