Show More
@@ -80,9 +80,24 b' def itersubrepos(ctx1, ctx2):' | |||||
80 | # has been modified (in ctx2) but not yet committed (in ctx1). |
|
80 | # has been modified (in ctx2) but not yet committed (in ctx1). | |
81 | subpaths = dict.fromkeys(ctx2.substate, ctx2) |
|
81 | subpaths = dict.fromkeys(ctx2.substate, ctx2) | |
82 | subpaths.update(dict.fromkeys(ctx1.substate, ctx1)) |
|
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 | for subpath, ctx in sorted(subpaths.iteritems()): |
|
91 | for subpath, ctx in sorted(subpaths.iteritems()): | |
84 | yield subpath, ctx.sub(subpath) |
|
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 | def nochangesfound(ui, repo, excluded=None): |
|
101 | def nochangesfound(ui, repo, excluded=None): | |
87 | '''Report no changes for push/pull, excluded is None or a list of |
|
102 | '''Report no changes for push/pull, excluded is None or a list of | |
88 | nodes excluded from the push/pull. |
|
103 | nodes excluded from the push/pull. |
@@ -106,6 +106,7 b' handle subrepos safely on qnew' | |||||
106 | [255] |
|
106 | [255] | |
107 | % update substate when adding .hgsub w/clean updated subrepo |
|
107 | % update substate when adding .hgsub w/clean updated subrepo | |
108 | A .hgsub |
|
108 | A .hgsub | |
|
109 | A sub/a | |||
109 | % qnew -X path:no-effect -m0 0.diff |
|
110 | % qnew -X path:no-effect -m0 0.diff | |
110 | path sub |
|
111 | path sub | |
111 | source sub |
|
112 | source sub | |
@@ -121,6 +122,7 b' handle subrepos safely on qnew' | |||||
121 | [255] |
|
122 | [255] | |
122 | % update substate when modifying .hgsub w/clean updated subrepo |
|
123 | % update substate when modifying .hgsub w/clean updated subrepo | |
123 | M .hgsub |
|
124 | M .hgsub | |
|
125 | A sub2/a | |||
124 | % qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff |
|
126 | % qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff | |
125 | path sub |
|
127 | path sub | |
126 | source sub |
|
128 | source sub | |
@@ -165,6 +167,7 b' handle subrepos safely on qrefresh' | |||||
165 | [255] |
|
167 | [255] | |
166 | % update substate when adding .hgsub w/clean updated subrepo |
|
168 | % update substate when adding .hgsub w/clean updated subrepo | |
167 | A .hgsub |
|
169 | A .hgsub | |
|
170 | A sub/a | |||
168 | % qrefresh |
|
171 | % qrefresh | |
169 | path sub |
|
172 | path sub | |
170 | source sub |
|
173 | source sub | |
@@ -181,6 +184,7 b' handle subrepos safely on qrefresh' | |||||
181 | [255] |
|
184 | [255] | |
182 | % update substate when modifying .hgsub w/clean updated subrepo |
|
185 | % update substate when modifying .hgsub w/clean updated subrepo | |
183 | M .hgsub |
|
186 | M .hgsub | |
|
187 | A sub2/a | |||
184 | % qrefresh |
|
188 | % qrefresh | |
185 | path sub |
|
189 | path sub | |
186 | source sub |
|
190 | source sub | |
@@ -304,6 +308,7 b' handle subrepos safely on qrecord' | |||||
304 | [255] |
|
308 | [255] | |
305 | % update substate when adding .hgsub w/clean updated subrepo |
|
309 | % update substate when adding .hgsub w/clean updated subrepo | |
306 | A .hgsub |
|
310 | A .hgsub | |
|
311 | A sub/a | |||
307 | % qrecord --config ui.interactive=1 -m0 0.diff |
|
312 | % qrecord --config ui.interactive=1 -m0 0.diff | |
308 | diff --git a/.hgsub b/.hgsub |
|
313 | diff --git a/.hgsub b/.hgsub | |
309 | new file mode 100644 |
|
314 | new file mode 100644 | |
@@ -339,6 +344,7 b' handle subrepos safely on qrecord' | |||||
339 | [255] |
|
344 | [255] | |
340 | % update substate when modifying .hgsub w/clean updated subrepo |
|
345 | % update substate when modifying .hgsub w/clean updated subrepo | |
341 | M .hgsub |
|
346 | M .hgsub | |
|
347 | A sub2/a | |||
342 | % qrecord --config ui.interactive=1 -m1 1.diff |
|
348 | % qrecord --config ui.interactive=1 -m1 1.diff | |
343 | diff --git a/.hgsub b/.hgsub |
|
349 | diff --git a/.hgsub b/.hgsub | |
344 | 1 hunks, 1 lines changed |
|
350 | 1 hunks, 1 lines changed |
@@ -1703,4 +1703,37 b" Test that '[paths]' is configured correc" | |||||
1703 | [paths] |
|
1703 | [paths] | |
1704 | default = $TESTTMP/t/t |
|
1704 | default = $TESTTMP/t/t | |
1705 | default-push = /foo/bar/t |
|
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 | $ cd .. |
|
1739 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now