[PATCH 1 of 3] subrepo: make subrepo.subrepo(<not a subrepo path>) fail

Dov Feldstern dovdevel at gmail.com
Sun May 20 13:27:49 CDT 2012


# HG changeset patch
# User Dov Feldstern <dfeldstern at gmail.com>
# Date 1337537494 -10800
# Branch stable
# Node ID 4585b54fbedcc83df50088ed37a3d5ade772032a
# Parent  7002bb17cc5eceb8c1ab792bdaf10bd96c08c8d8
subrepo: make subrepo.subrepo(<not a subrepo path>) fail

Until now, when calling subrepo.subrepo with a path at which there is no
subrepo, a "nullstate" tuple would be returned. However, this is not very
useful (the tuple can't really be used for creating a subrepo), so we'd just as
soon have the function just fail, and leave it up to the caller to decide what
to do.

The motivation for doing this now is to simplify the solution for (issue3056).

diff -r 7002bb17cc5e -r 4585b54fbedc mercurial/subrepo.py
--- a/mercurial/subrepo.py	Mon May 14 13:25:42 2012 +0100
+++ b/mercurial/subrepo.py	Sun May 20 21:11:34 2012 +0300
@@ -267,7 +267,7 @@
     hg = h
 
     scmutil.pathauditor(ctx._repo.root)(path)
-    state = ctx.substate.get(path, nullstate)
+    state = ctx.substate[path]
     if state[2] not in types:
         raise util.Abort(_('unknown subrepo type %s') % state[2])
     return types[state[2]](ctx, path, state[:2])


More information about the Mercurial-devel mailing list