hg unknown: list unknown files
1 files changed, 12 insertions(+), 4 deletions(-)

M hgrc
M hgrc +12 -4
@@ 366,10 366,18 @@ toecho = !
         echo "echo = $remote"
 
 # hg unknown: print names of unknown files
-# Uses debugfileset because I can't get `hg files 'set:unknown()' to print
-# anything.
-# Unlike in bash, * also matches hidden files.
-unknown = debugfileset 'unknown() and ./*'
+# - only prints files under current dir
+# - prints paths relative to current dir
+# - Uses debugfileset because I can't get `hg files 'set:unknown()' to print
+#   anything.
+unknown = !
+    cwd="$(pwd)"
+    root="$(hg root)"
+    # '/**' is sufficient: it also matches hidden files
+    hg debugfileset 'unknown() and ./**' | while read p; do
+        realpath --relative-to "$cwd" "$root/$p"
+    done
+
 
 # hg versions:
 # Place multiple versions of file in directory, for easy comparison when