I'm trying to get a list of the current files and dirs using the following command:
hg manifest -r tip
However, this brings a list like this:
.hgtags
folder1/blah.c
folder1/blah.h
foo.json
folder2/bleh.c
folder2/bleh.h
test.json
How can I list only the following?
.hgtags
folder1
foo.json
folder2
test.json
On Unix machine you could try:
hg manifest -r tip | cut -d "/" -f 1 | sort -u
or
hg manifest -r tip | cut -d "/" -f 1 | uniq
cut -d "/" -f 1
: select first portion delimited by '/'uniq
: filter out repeated linesOr using Python (more cross-platform):
You need to have python-glib installed (via pip)
import hglib
repo = hglib.open("/path/to/repo")
manifest = repo.manifest("tip")
files = set(f[4].split('/')[0] for f in manifest)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With