Comments
Patch
@@ -349,11 +349,18 @@
pointers[p.oid()] = p
return sorted(pointers.values())
-def pointerfromctx(ctx, f):
+def pointerfromctx(ctx, f, removed=False):
"""return a pointer for the named file from the given changectx, or None if
the file isn't LFS."""
if f not in ctx:
- return None
+ if not removed:
+ return None
+ if f in ctx.p1():
+ ctx = ctx.p1()
+ elif f in ctx.p2():
+ ctx = ctx.p2()
+ else:
+ return None
fctx = ctx[f]
if not _islfs(fctx.filelog(), fctx.filenode()):
return None
@@ -363,11 +370,11 @@
raise error.Abort(_('lfs: corrupted pointer (%s@%s): %s\n')
% (f, short(ctx.node()), ex))
-def pointersfromctx(ctx):
+def pointersfromctx(ctx, removed=False):
"""return a dict {path: pointer} for given single changectx"""
result = {}
for f in ctx.files():
- p = pointerfromctx(ctx, f)
+ p = pointerfromctx(ctx, f, removed=removed)
if p:
result[f] = p
return result