Mercurial > public > mercurial-scm > hg
comparison mercurial/logcmdutil.py @ 42010:db26dbbee74d
diff: support diffing explicit files in subrepos
Most other commands support implied recursion based on file names already.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 21 Mar 2019 21:40:22 -0400 |
parents | 77ef3498ceb3 |
children | 1ce46f0ee218 |
comparison
equal
deleted
inserted
replaced
42009:8f427f7c1f71 | 42010:db26dbbee74d |
---|---|
127 ui.write(chunk) | 127 ui.write(chunk) |
128 else: | 128 else: |
129 for chunk, label in chunks: | 129 for chunk, label in chunks: |
130 ui.write(chunk, label=label) | 130 ui.write(chunk, label=label) |
131 | 131 |
132 if listsubrepos: | 132 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
133 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): | 133 tempnode2 = node2 |
134 tempnode2 = node2 | 134 try: |
135 try: | 135 if node2 is not None: |
136 if node2 is not None: | 136 tempnode2 = ctx2.substate[subpath][1] |
137 tempnode2 = ctx2.substate[subpath][1] | 137 except KeyError: |
138 except KeyError: | 138 # A subrepo that existed in node1 was deleted between node1 and |
139 # A subrepo that existed in node1 was deleted between node1 and | 139 # node2 (inclusive). Thus, ctx2's substate won't contain that |
140 # node2 (inclusive). Thus, ctx2's substate won't contain that | 140 # subpath. The best we can do is to ignore it. |
141 # subpath. The best we can do is to ignore it. | 141 tempnode2 = None |
142 tempnode2 = None | 142 submatch = matchmod.subdirmatcher(subpath, match) |
143 submatch = matchmod.subdirmatcher(subpath, match) | 143 subprefix = repo.wvfs.reljoin(prefix, subpath) |
144 subprefix = repo.wvfs.reljoin(prefix, subpath) | 144 if listsubrepos or match.exact(subpath) or any(submatch.files()): |
145 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, | 145 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, |
146 stat=stat, fp=fp, prefix=subprefix) | 146 stat=stat, fp=fp, prefix=subprefix) |
147 | 147 |
148 class changesetdiffer(object): | 148 class changesetdiffer(object): |
149 """Generate diff of changeset with pre-configured filtering functions""" | 149 """Generate diff of changeset with pre-configured filtering functions""" |