简体   繁体   中英

Mercurial - How to get a list of files that are different between two repositories

I have two related Mercurial repositories. Repository A has a lot of changes that are not in repository B. I want to generate a list of file names that are different between repository A and repository B

Here is what I have so far:

A text file named hg_outconfig.txt with the following text:

changeset = "{file_mods}\n{file_dels}\n{file_adds}"
file_mod = "{file_mod}\n"
file_add = "{file_add}\n"
file_del = "{file_del}\n"

Then I am running the commands:

cd PATH_TO_REPO_A
hg -q outgoing URL_TO_REPO_B --style c:\\hg_outconfig.txt | sort

This does list all files in repo A that have changed, but it also lists files in repo A that have changes from previous commits that are already in repo B. I want just a list of files that have current differences between repo A and repo B.

... --template "{files}\\n" will give you far from nice and pretty, but correct output

From my test

hg incoming --template="{files}\n" -q
footer.php functions.php header.php readme.txt search.php style.css
comments.php functions.php header.php readme.txt sidebar.php style.css
readme.txt sidebar.php style.css
functions.php readme.txt screenshot.png style.css

4 strings are 4 changesets, files in changeset are space-separated

Ok I figured out how to do this. In order to list outgoing files and exclude merges you can use the -M argument with the outgoing command. So

hg -q outgoing -M remote_repo_url

will give you a list of files that are different between the two repositories.

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