[PATCH 12 of 19 STABLE] largefiles: show status for removed file in working context correctly
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Mon Feb 27 10:46:37 UTC 2012
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1330335216 -32400
# Branch stable
# Node ID 15efcfa1e00dc6a773d963da69271f3fc0660eaa
# Parent 5c5ac9b4a72636ac865f68227d291a48d3c84206
largefiles: show status for removed file in working context correctly
original implementation examines whether each specified patterns are
related to largefiles or not by 'f in context'. but '__contains__()'
of 'workingctx' returns False for removed files.
so, 'hg status' can't show status of removed largefiles in working
context correctly.
this patch uses 'f in dirstate' for working context instead of 'f in
context'.
diff -r 5c5ac9b4a726 -r 15efcfa1e00d hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py Mon Feb 27 18:33:36 2012 +0900
+++ b/hgext/largefiles/reposetup.py Mon Feb 27 18:33:36 2012 +0900
@@ -109,7 +109,13 @@
parentworking = working and ctx1 == self['.']
def inctx(file, ctx):
- return file in ctx
+ if ctx.rev() is None:
+ # use dirstate directly not only for efficiency,
+ # because 'f in workingctx' returns False
+ # for removed files
+ return file in repo.dirstate
+ else:
+ return file in ctx
def inctxdirs(f, ctx):
return f in ctx.dirs()
diff -r 5c5ac9b4a726 -r 15efcfa1e00d tests/test-largefiles.t
--- a/tests/test-largefiles.t Mon Feb 27 18:33:36 2012 +0900
+++ b/tests/test-largefiles.t Mon Feb 27 18:33:36 2012 +0900
@@ -1081,3 +1081,20 @@
C sub/a.large
$ cd ..
+
+tests for pattern matching for removed files in working context:
+
+ $ hg init removedfiles
+ $ cd removedfiles
+
+ $ echo a > a.large
+ $ hg add --large a.large
+ $ hg commit -m '#0'
+ Invoking status precommit hook
+ A a.large
+
+ $ hg remove a.large
+ $ hg status -A a.large
+ R a.large
+
+ $ cd ..
More information about the Mercurial-devel
mailing list