简体   繁体   中英

In Mercurial, after hg merge, how to revert files marked 'U' and matching a pattern to a specific revision?

In Mercurial, after hg merge, how to revert files marked 'U' and matching a pattern to a specific revision?

After doing 'hg merge' I find a class of files matching a pattern and marked 'U' to be mistakenly merged and would like to revert them to the last version. How to do that?

This will revert unresolved text files back to the first parent of the merge. Use p2() for second parent:

hg revert "set:*.txt and unresolved()" --rev p1()

You may then need this to clear the unresolved flag:

hg resolve --mark *.txt

Edit

Per your comments, I tested this command successfully on Windows:

hg revert "set:'re:[0-9]foobar.*\.txt' and unresolved()" -r "p1()"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM