##// END OF EJS Templates
subrepos: handle modified but uncommitted .hgsub
Martin Geisler -
r12175:c0a8f9de default
parent child Browse files
Show More
@@ -682,10 +682,17 b' def diffordiffstat(ui, repo, diffopts, n'
682
682
683 if listsubrepos:
683 if listsubrepos:
684 ctx1 = repo[node1]
684 ctx1 = repo[node1]
685 for subpath in ctx1.substate:
685 ctx2 = repo[node2]
686 sub = ctx1.sub(subpath)
686 # Create a (subpath, ctx) mapping where we prefer subpaths
687 # from ctx1. The subpaths from ctx2 are important when the
688 # .hgsub file has been modified (in ctx2) but not yet
689 # committed (in ctx1).
690 subpaths = dict.fromkeys(ctx2.substate, ctx2)
691 subpaths.update(dict.fromkeys(ctx1.substate, ctx1))
692 for subpath, ctx in subpaths.iteritems():
693 sub = ctx.sub(subpath)
687 if node2 is not None:
694 if node2 is not None:
688 node2 = bin(repo[node2].substate[subpath][1])
695 node2 = bin(ctx2.substate[subpath][1])
689 submatch = matchmod.narrowmatcher(subpath, match)
696 submatch = matchmod.narrowmatcher(subpath, match)
690 sub.diff(diffopts, node2, submatch, changes=changes,
697 sub.diff(diffopts, node2, submatch, changes=changes,
691 stat=stat, fp=fp, prefix=prefix)
698 stat=stat, fp=fp, prefix=prefix)
@@ -1161,8 +1161,14 b' class localrepository(repo.repository):'
1161 r = modified, added, removed, deleted, unknown, ignored, clean
1161 r = modified, added, removed, deleted, unknown, ignored, clean
1162
1162
1163 if listsubrepos:
1163 if listsubrepos:
1164 for subpath in ctx1.substate:
1164 # Create a (subpath, ctx) mapping where we prefer subpaths
1165 sub = ctx1.sub(subpath)
1165 # from ctx1. The subpaths from ctx2 are important when the
1166 # .hgsub file has been modified (in ctx2) but not yet
1167 # committed (in ctx1).
1168 subpaths = dict.fromkeys(ctx2.substate, ctx2)
1169 subpaths.update(dict.fromkeys(ctx1.substate, ctx1))
1170 for subpath, ctx in subpaths.iteritems():
1171 sub = ctx.sub(subpath)
1166 if working:
1172 if working:
1167 rev2 = None
1173 rev2 = None
1168 else:
1174 else:
@@ -28,6 +28,36 b' Create test repository:'
28 $ echo 'foo = foo' > .hgsub
28 $ echo 'foo = foo' > .hgsub
29 $ hg add .hgsub
29 $ hg add .hgsub
30
30
31 Test recursive status without committing anything:
32
33 $ hg status
34 A .hgsub
35 A foo/.hgsub
36 A foo/bar/z.txt
37 A foo/y.txt
38 A x.txt
39
40 Test recursive diff without committing anything:
41
42 $ hg diff foo
43 diff -r 000000000000 foo/.hgsub
44 --- /dev/null
45 +++ b/foo/.hgsub
46 @@ -0,0 +1,1 @@
47 +bar = bar
48 diff -r 000000000000 foo/y.txt
49 --- /dev/null
50 +++ b/foo/y.txt
51 @@ -0,0 +1,1 @@
52 +y1
53 diff -r 000000000000 foo/bar/z.txt
54 --- /dev/null
55 +++ b/foo/bar/z.txt
56 @@ -0,0 +1,1 @@
57 +z1
58
59 Commits:
60
31 $ hg commit -m 0-0-0
61 $ hg commit -m 0-0-0
32 committing subrepository foo
62 committing subrepository foo
33 committing subrepository foo/bar
63 committing subrepository foo/bar
General Comments 0
You need to be logged in to leave comments. Login now