[PATCH 1 of 1] subrepo: docstrings

Mads Kiilerich mads at kiilerich.com
Thu Jul 15 06:25:14 CDT 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1279193042 -7200
# Node ID 3e8a114d05c0855dc8ba75fe54d4c1d21495a326
# Parent  23fa72a130bfc3c2fe3fef0dc5f0a4f6421ced4f
subrepo: docstrings

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -13,6 +13,8 @@
 nullstate = ('', '', 'empty')
 
 def state(ctx):
+    """return a state dict, mapping subrepo paths configured in .hgsub to tuple:
+    (source from .hgsub, revision from .hgsubstate, kind (key in types dict))"""
     p = config.config()
     def read(f, sections=None, remap=None):
         if f in ctx:
@@ -46,12 +48,14 @@
     return state
 
 def writestate(repo, state):
+    """rewrite .hgsubstate in (outer) repo with these subrepo states"""
     repo.wwrite('.hgsubstate',
                 ''.join(['%s %s\n' % (state[s][1], s)
                          for s in sorted(state)]), '')
 
 def submerge(repo, wctx, mctx, actx):
-    # working context, merging context, ancestor context
+    """delegated from merge.applyupdates: merging of .hgsubstate file in
+    working context, merging context and ancestor context"""
     if mctx == actx: # backwards?
         actx = wctx.p1()
     s1 = wctx.substate
@@ -131,6 +135,7 @@
     writestate(repo, sm)
 
 def relpath(sub):
+    """return path to this subrepo as seen from outermost repo"""
     if not hasattr(sub, '_repo'):
         return sub._path
     parent = sub._repo
@@ -139,6 +144,8 @@
     return sub._repo.root[len(parent.root)+1:]
 
 def _abssource(repo, push=False):
+    """return pull/push path of repo - either based on parent repo .hgsub
+    info or on the subrepos own config"""
     if hasattr(repo, '_subparent'):
         source = repo._subsource
         if source.startswith('/') or '://' in source:
@@ -158,6 +165,7 @@
     return repo.ui.config('paths', 'default', repo.root)
 
 def subrepo(ctx, path):
+    """return instance of the right subrepo class for subrepo in path"""
     # subrepo inherently violates our import layering rules
     # because it wants to make repo objects from deep inside the stack
     # so we manually delay the circular imports to not break
@@ -207,7 +215,7 @@
         raise NotImplementedError
 
     def push(self, force):
-        """perform whatever action is analagous to 'hg push'
+        """perform whatever action is analogous to 'hg push'
 
         This may be a no-op on some systems.
         """


More information about the Mercurial-devel mailing list