Patchwork [1,of,4] files: actually filter out removed files

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 30, 2014, 11:08 p.m.
Message ID <cd1e5a9bcba5ffd16df5.1412118499@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6055/
State Accepted
Headers show

Comments

Siddharth Agarwal - Sept. 30, 2014, 11:08 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1412117148 25200
#      Tue Sep 30 15:45:48 2014 -0700
# Node ID cd1e5a9bcba5ffd16df59046db42428a0d779dbc
# Parent  939ce500c92a3dcc0e10815242361ff70a6fcae9
files: actually filter out removed files

'hg files' makes an attempt to filter out removed files, but that doesn't work
because repo.dirstate[f] returns lowercase 'f', not uppercase.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3220,7 +3220,7 @@ 
 
     m = scmutil.match(ctx, pats, opts)
     for f in ctx.walk(m):
-        if rev is None and repo.dirstate[f] in 'R?!':
+        if rev is None and repo.dirstate[f] in 'r?!':
             continue
         fm.startitem()
         if ui.verbose:
diff --git a/tests/test-locate.t b/tests/test-locate.t
--- a/tests/test-locate.t
+++ b/tests/test-locate.t
@@ -87,6 +87,8 @@ 
   $ cd ..
   $ rm -r t
 
+  $ hg rm t/b
+
   $ hg locate 't/**'
   t/b (glob)
   t/e.h (glob)
@@ -96,7 +98,6 @@ 
   b
   dir.h/foo
   t.h
-  t/b
   t/e.h
   t/x
   $ hg files b
@@ -132,7 +133,6 @@ 
   ../b
   ../dir.h/foo
   ../t.h
-  ../t/b
   ../t/e.h
   ../t/x
   $ hg files .