Dawhol
Dawhol

Reputation: 23

hg status list without status

I have to get list of changed, added or removed files since last commit. command: hg status gives me for example

M file_path
C other_file_path

I need:

file_path
other_file_path

Solution have to work in Unix & Windows.

Upvotes: 2

Views: 634

Answers (1)

icabod
icabod

Reputation: 7074

If you want to list all of the files, you can simply add -n to the hg status command:

$ hg status
M modded.txt
A added.txt
R removed.txt
? unknown.txt

$ hg status -n
modded.txt
added.txt
removed.txt
unknown.txt

However, this will also list unknown files (those that are new, but have not been specifically added to the repository with a hg add command). You can get around this by adding either -q (as Lazy Badger points out), or by using filesets (see hg help filesets) to specify all files that aren't unknown:

$ hg status -n -q
modded.txt
added.txt
removed.txt

$ hg status -n "set:!unknown()"
modded.txt
added.txt
removed.txt

You can specify which types of files are listed by combining the other options (-a -r for example will show added and removed files). Alternatively you can do clever things with filesets: for example, only listing the names of files that are removed by using "set:removed()"

Upvotes: 4

Related Questions