##// END OF EJS Templates
context: add a blockdescendants function...
Denis Laxalde -
r31937:826e6006 default
parent child Browse files
Show More
@@ -1208,6 +1208,26 b' def blockancestors(fctx, fromline, tolin'
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."""
General Comments 0
You need to be logged in to leave comments. Login now