Show More
@@ -0,0 +1,35 b'' | |||
|
1 | # subrepo.py - sub-repository handling for Mercurial | |
|
2 | # | |
|
3 | # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> | |
|
4 | # | |
|
5 | # This software may be used and distributed according to the terms of the | |
|
6 | # GNU General Public License version 2, incorporated herein by reference. | |
|
7 | ||
|
8 | import config, util, errno | |
|
9 | ||
|
10 | def state(ctx): | |
|
11 | p = config.config() | |
|
12 | def read(f, sections=None, remap=None): | |
|
13 | if f in ctx: | |
|
14 | try: | |
|
15 | p.parse(f, ctx[f].data(), sections, remap) | |
|
16 | except IOError, err: | |
|
17 | if err.errno != errno.ENOENT: | |
|
18 | raise | |
|
19 | read('.hgsub') | |
|
20 | ||
|
21 | rev = {} | |
|
22 | if '.hgsubstate' in ctx: | |
|
23 | try: | |
|
24 | for l in ctx['.hgsubstate'].data().splitlines(): | |
|
25 | revision, path = l.split() | |
|
26 | rev[path] = revision | |
|
27 | except IOError, err: | |
|
28 | if err.errno != errno.ENOENT: | |
|
29 | raise | |
|
30 | ||
|
31 | state = {} | |
|
32 | for path, src in p[''].items(): | |
|
33 | state[path] = (src, rev.get(path, '')) | |
|
34 | ||
|
35 | return state |
@@ -857,6 +857,14 b' def debugstate(ui, repo, nodates=None):' | |||
|
857 | 857 | for f in repo.dirstate.copies(): |
|
858 | 858 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
859 | 859 | |
|
860 | def debugsub(ui, repo, rev=None): | |
|
861 | if rev == '': | |
|
862 | rev = None | |
|
863 | for k,v in sorted(repo[rev].substate.items()): | |
|
864 | ui.write('path %s\n' % k) | |
|
865 | ui.write(' source %s\n' % v[0]) | |
|
866 | ui.write(' revision %s\n' % v[1]) | |
|
867 | ||
|
860 | 868 | def debugdata(ui, file_, rev): |
|
861 | 869 | """dump the contents of a data file revision""" |
|
862 | 870 | r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") |
@@ -3228,6 +3236,10 b' table = {' | |||
|
3228 | 3236 | (debugstate, |
|
3229 | 3237 | [('', 'nodates', None, _('do not display the saved mtime'))], |
|
3230 | 3238 | _('[OPTION]...')), |
|
3239 | "debugsub": | |
|
3240 | (debugsub, | |
|
3241 | [('r', 'rev', '', _('revision to check'))], | |
|
3242 | _('[-r REV] [REV]')), | |
|
3231 | 3243 | "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')), |
|
3232 | 3244 | "^diff": |
|
3233 | 3245 | (diff, |
@@ -7,7 +7,7 b'' | |||
|
7 | 7 | |
|
8 | 8 | from node import nullid, nullrev, short, hex |
|
9 | 9 | from i18n import _ |
|
10 | import ancestor, bdiff, error, util | |
|
10 | import ancestor, bdiff, error, util, subrepo | |
|
11 | 11 | import os, errno |
|
12 | 12 | |
|
13 | 13 | propertycache = util.propertycache |
@@ -73,6 +73,10 b' class changectx(object):' | |||
|
73 | 73 | p = p[:-1] |
|
74 | 74 | return [changectx(self._repo, x) for x in p] |
|
75 | 75 | |
|
76 | @propertycache | |
|
77 | def substate(self): | |
|
78 | return subrepo.state(self) | |
|
79 | ||
|
76 | 80 | def __contains__(self, key): |
|
77 | 81 | return key in self._manifest |
|
78 | 82 |
@@ -73,6 +73,7 b' debugrebuildstate' | |||
|
73 | 73 | debugrename |
|
74 | 74 | debugsetparents |
|
75 | 75 | debugstate |
|
76 | debugsub | |
|
76 | 77 | debugwalk |
|
77 | 78 | |
|
78 | 79 | % Do not show the alias of a debug command if there are other candidates |
@@ -199,6 +200,7 b' debugrebuildstate: rev' | |||
|
199 | 200 | debugrename: rev |
|
200 | 201 | debugsetparents: |
|
201 | 202 | debugstate: nodates |
|
203 | debugsub: rev | |
|
202 | 204 | debugwalk: include, exclude |
|
203 | 205 | grep: print0, all, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude |
|
204 | 206 | heads: rev, active, closed, style, template |
General Comments 0
You need to be logged in to leave comments.
Login now