diff mercurial/hg.py @ 34879:7d51a7792f52

subrepo: implement 'unshare' for Mercurial subrepos I think there's a slight hole here in that a subrepo could be shared, removed from .hgsub, and then it's not part of context.substate (so not iterated over). But the push command has the same hole IIRC, and I think removing a subrepo is an edge case. The import hack is a copy/paste of subrepo.subrepo().
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 17 Oct 2017 22:55:33 -0400
parents 9f7ecc5bbc28
children b64ea7fb9599
line wrap: on
line diff
--- a/mercurial/hg.py	Tue Oct 17 21:48:56 2017 -0400
+++ b/mercurial/hg.py	Tue Oct 17 22:55:33 2017 -0400
@@ -286,6 +286,13 @@
     # update store, spath, svfs and sjoin of repo
     repo.unfiltered().__init__(repo.baseui, repo.root)
 
+    # TODO: figure out how to access subrepos that exist, but were previously
+    #       removed from .hgsub
+    c = repo['.']
+    subs = c.substate
+    for s in sorted(subs):
+        c.sub(s).unshare()
+
 def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
     """Called after a new shared repo is created.