diff mercurial/fileset.py @ 14685:394121d9f4fc

fileset: add copied predicate
author Matt Mackall <mpm@selenic.com>
date Sat, 18 Jun 2011 16:53:49 -0500
parents 87b9d6a7d807
children 25e4d2f35965
line wrap: on
line diff
--- a/mercurial/fileset.py	Sat Jun 18 16:53:49 2011 -0500
+++ b/mercurial/fileset.py	Sat Jun 18 16:53:49 2011 -0500
@@ -335,10 +335,22 @@
 
     return s
 
+def copied(mctx, x):
+    """``copied()``
+    File that is recorded as being copied.
+    """
+    s = []
+    for f in mctx.subset:
+        p = mctx.ctx[f].parents()
+        if p and p[0].path() != f:
+            s.append(f)
+    return s
+
 symbols = {
     'added': added,
     'binary': binary,
     'clean': clean,
+    'copied': copied,
     'deleted': deleted,
     'encoding': encoding,
     'exec': exec_,