##// END OF EJS Templates
scmutil: consistently return subrepos relative to ctx1 from itersubrepos()...
Matt Harbison -
r25418:c0995cd8 default
parent child Browse files
Show More
@@ -80,9 +80,24 b' def itersubrepos(ctx1, ctx2):'
80 80 # has been modified (in ctx2) but not yet committed (in ctx1).
81 81 subpaths = dict.fromkeys(ctx2.substate, ctx2)
82 82 subpaths.update(dict.fromkeys(ctx1.substate, ctx1))
83
84 missing = set()
85
86 for subpath in ctx2.substate:
87 if subpath not in ctx1.substate:
88 del subpaths[subpath]
89 missing.add(subpath)
90
83 91 for subpath, ctx in sorted(subpaths.iteritems()):
84 92 yield subpath, ctx.sub(subpath)
85 93
94 # Yield an empty subrepo based on ctx1 for anything only in ctx2. That way,
95 # status and diff will have an accurate result when it does
96 # 'sub.{status|diff}(rev2)'. Otherwise, the ctx2 subrepo is compared
97 # against itself.
98 for subpath in missing:
99 yield subpath, ctx2.nullsub(subpath, ctx1)
100
86 101 def nochangesfound(ui, repo, excluded=None):
87 102 '''Report no changes for push/pull, excluded is None or a list of
88 103 nodes excluded from the push/pull.
@@ -106,6 +106,7 b' handle subrepos safely on qnew'
106 106 [255]
107 107 % update substate when adding .hgsub w/clean updated subrepo
108 108 A .hgsub
109 A sub/a
109 110 % qnew -X path:no-effect -m0 0.diff
110 111 path sub
111 112 source sub
@@ -121,6 +122,7 b' handle subrepos safely on qnew'
121 122 [255]
122 123 % update substate when modifying .hgsub w/clean updated subrepo
123 124 M .hgsub
125 A sub2/a
124 126 % qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff
125 127 path sub
126 128 source sub
@@ -165,6 +167,7 b' handle subrepos safely on qrefresh'
165 167 [255]
166 168 % update substate when adding .hgsub w/clean updated subrepo
167 169 A .hgsub
170 A sub/a
168 171 % qrefresh
169 172 path sub
170 173 source sub
@@ -181,6 +184,7 b' handle subrepos safely on qrefresh'
181 184 [255]
182 185 % update substate when modifying .hgsub w/clean updated subrepo
183 186 M .hgsub
187 A sub2/a
184 188 % qrefresh
185 189 path sub
186 190 source sub
@@ -304,6 +308,7 b' handle subrepos safely on qrecord'
304 308 [255]
305 309 % update substate when adding .hgsub w/clean updated subrepo
306 310 A .hgsub
311 A sub/a
307 312 % qrecord --config ui.interactive=1 -m0 0.diff
308 313 diff --git a/.hgsub b/.hgsub
309 314 new file mode 100644
@@ -339,6 +344,7 b' handle subrepos safely on qrecord'
339 344 [255]
340 345 % update substate when modifying .hgsub w/clean updated subrepo
341 346 M .hgsub
347 A sub2/a
342 348 % qrecord --config ui.interactive=1 -m1 1.diff
343 349 diff --git a/.hgsub b/.hgsub
344 350 1 hunks, 1 lines changed
@@ -1703,4 +1703,37 b" Test that '[paths]' is configured correc"
1703 1703 [paths]
1704 1704 default = $TESTTMP/t/t
1705 1705 default-push = /foo/bar/t
1706
1707 $ cd $TESTTMP/t
1708 $ hg up -qC 0
1709 $ echo 'bar' > bar.txt
1710 $ hg ci -Am 'branch before subrepo add'
1711 adding bar.txt
1712 created new head
1713 $ hg merge -r "first(subrepo('s'))"
1714 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1715 (branch merge, don't forget to commit)
1716 $ hg status -S -X '.hgsub*'
1717 A s/a
1718 ? s/b
1719 ? s/c
1720 ? s/f1
1721 $ hg status -S --rev 'p2()'
1722 A bar.txt
1723 ? s/b
1724 ? s/c
1725 ? s/f1
1726 $ hg diff -S -X '.hgsub*' --nodates
1727 diff -r 000000000000 s/a
1728 --- /dev/null
1729 +++ b/s/a
1730 @@ -0,0 +1,1 @@
1731 +a
1732 $ hg diff -S --rev 'p2()' --nodates
1733 diff -r 7cf8cfea66e4 bar.txt
1734 --- /dev/null
1735 +++ b/bar.txt
1736 @@ -0,0 +1,1 @@
1737 +bar
1738
1706 1739 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now