Arwa
Arwa

Reputation: 587

Get all changed files in a changest

I want to get all the changed file in a changeset but without having the letter that specify the change type.

I know this command

hg status --change changeset

However, this return result like,

A /path/to/file
M /path/to/file

I want the result to be

/path/to/file

without "A" or "M". I tried to do it with regular expression and it used to work but I don't know it didn't work in one scenario.

The regular expression,

/(?<=[MA]\s).+/

This the scenario that did not work

arwa/Documents/Projects/firefox/M db << notice M here. 

Any thought?

Upvotes: 0

Views: 43

Answers (3)

Lazy Badger
Lazy Badger

Reputation: 97280

Why not use log with template?

hg log -r CSET -T "{files % '{file}\n'}"

will produce clean output

lang/UTF-8/serendipity_lang_ru.inc.php
plugins/serendipity_event_bbcode/UTF-8/lang_ru.inc.php
plugins/serendipity_event_emoticate/UTF-8/lang_ru.inc.php
plugins/serendipity_event_karma/UTF-8/lang_ru.inc.php
plugins/serendipity_event_s9ymarkup/UTF-8/lang_ru.inc.php
plugins/serendipity_plugin_shoutbox/UTF-8/lang_ru.inc.php

contrary to templated status

'lang\UTF-8\serendipity_lang_ru.inc.php
''plugins\serendipity_event_bbcode\UTF-8\lang_ru.inc.php
''plugins\serendipity_event_emoticate\UTF-8\lang_ru.inc.php
''plugins\serendipity_event_karma\UTF-8\lang_ru.inc.php
''plugins\serendipity_event_s9ymarkup\UTF-8\lang_ru.inc.php
''plugins\serendipity_plugin_shoutbox\UTF-8\lang_ru.inc.php
'

Upvotes: 1

Reimer Behrends
Reimer Behrends

Reputation: 8720

As of Mercurial 3.5, you can use templates (still an experimental feature, you can see it with hg help status -v). Namely:

hg status --change <rev> --template '{path}\n'

Upvotes: 1

ndnenkov
ndnenkov

Reputation: 36101

You should add ^ (start of line) to your regex:

/(?<=^[MA]\s).+/

If you don't do that, (?<=[MA]\s) will lookabehind the M part and .+ will catch db.

Upvotes: 1

Related Questions