[PATCH 1 of 2] hg/repository: add subrepos method
Angel Ezquerra
angel.ezquerra at gmail.com
Mon Feb 29 01:38:06 UTC 2016
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1456709709 -3600
# Mon Feb 29 02:35:09 2016 +0100
# Branch stable
# Node ID e16bf58e69344c32cfec314efe6d27cd77596e59
# Parent 1c060576ac430bc9503cff6f8cbc1b4e0329b57f
hg/repository: add subrepos method
This new method returns a (sorted) list of subrepository paths that are refered
to by a given set of revisions. If no revisions are specified the current
repository heads are used by default.
diff --git a/kallithea/lib/vcs/backends/hg/repository.py b/kallithea/lib/vcs/backends/hg/repository.py
--- a/kallithea/lib/vcs/backends/hg/repository.py
+++ b/kallithea/lib/vcs/backends/hg/repository.py
@@ -227,6 +227,19 @@
self._repo._bookmarks.items()]
return OrderedDict(sorted(_bookmarks, key=sortkey, reverse=True))
+ def subrepos(self, revs=None):
+ """
+ Gets subrepo paths referenced by any of the selected revisions
+
+ Subrepo paths are returned relative to the root of the repository
+ """
+ if revs is None:
+ revs = self._repo.heads()
+ subpaths = set()
+ for r in revs:
+ subpaths = subpaths.union(set(self._repo[r].substate.keys()))
+ return sorted(list(subpaths))
+
def _get_all_revisions(self):
return [self._repo[x].hex() for x in self._repo.filtered('visible').changelog.revs()]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kallithea-1.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160229/8c29bc5a/attachment.bin>
More information about the kallithea-general
mailing list