1206 continue |
1206 continue |
1207 visit[p.linkrev(), p.filenode()] = p, linerange1 |
1207 visit[p.linkrev(), p.filenode()] = p, linerange1 |
1208 if inrange: |
1208 if inrange: |
1209 yield c, linerange2 |
1209 yield c, linerange2 |
1210 |
1210 |
|
1211 def blockdescendants(fctx, fromline, toline): |
|
1212 """Yield descendants of `fctx` with respect to the block of lines within |
|
1213 `fromline`-`toline` range. |
|
1214 """ |
|
1215 diffopts = patch.diffopts(fctx._repo.ui) |
|
1216 fl = fctx.filelog() |
|
1217 seen = {fctx.filerev(): (fctx, (fromline, toline))} |
|
1218 for i in fl.descendants([fctx.filerev()]): |
|
1219 c = fctx.filectx(i) |
|
1220 for x in fl.parentrevs(i): |
|
1221 try: |
|
1222 p, linerange2 = seen.pop(x) |
|
1223 except KeyError: |
|
1224 # nullrev or other branch |
|
1225 continue |
|
1226 inrange, linerange1 = _changesrange(c, p, linerange2, diffopts) |
|
1227 if inrange: |
|
1228 yield c, linerange1 |
|
1229 seen[i] = c, linerange1 |
|
1230 |
1211 class committablectx(basectx): |
1231 class committablectx(basectx): |
1212 """A committablectx object provides common functionality for a context that |
1232 """A committablectx object provides common functionality for a context that |
1213 wants the ability to commit, e.g. workingctx or memctx.""" |
1233 wants the ability to commit, e.g. workingctx or memctx.""" |
1214 def __init__(self, repo, text="", user=None, date=None, extra=None, |
1234 def __init__(self, repo, text="", user=None, date=None, extra=None, |
1215 changes=None): |
1235 changes=None): |