# HG changeset patch # User Jun Wu # Date 2017-12-18 22:37:00 # Node ID 488634db5928282dd0ae665f26a46d1eda049dd9 # Parent d624c8558c6156d92f046b0151973d2ca74262ba lfs: fix committing deleted files caused by e0a1b9ee93cd e0a1b9ee93cd (lfs: add a repo requirement for this extension once an lfs file is committed) introduced a regression that prevents committing file deletion. This patch fixes that. Differential Revision: https://phab.mercurial-scm.org/D1717 diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -124,7 +124,7 @@ def reposetup(ui, repo): if 'lfs' not in repo.requirements: ctx = repo[kwargs['node']] # TODO: is there a way to just walk the files in the commit? - if any(ctx[f].islfs() for f in ctx.files()): + if any(ctx[f].islfs() for f in ctx.files() if f in ctx): repo.requirements.add('lfs') repo._writerequirements() diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -680,3 +680,12 @@ This convert is trickier, because it con $ hg -R convert_lfs2 config --debug extensions | grep lfs $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob) + +Committing deleted files works: + + $ hg init $TESTTMP/repo-del + $ cd $TESTTMP/repo-del + $ echo 1 > A + $ hg commit -m 'add A' -A A + $ hg rm A + $ hg commit -m 'rm A'