tags:

views:

185

answers:

1

I'm using Mercurial and I'm trying to merge changes into my main repo. Some of those files in my main repo are write-protected. This makes the hg merge command fail with an abort: Access is denied.

I want to make those files which will be affected by the merge writable, and only those files (not the whole repo). Is there a way to make Mercurial print out a list of just those files which need to be resolved?

(PS. They're writable because they're controlled by Perforce. The reasons for this screwy setup are too dumb to relate here.)

+1  A: 

I don't know of any built-in way to do this easily... it's not a very common need. An extension could almost certainly be written to add a --dry-run option to hg merge much like hg revert's --dry-run option.

If you just want something quick and dirty, maybe something like this would work?

hg merge -Pv | grep files | sed -e's/files:\s*//' -e's/\s/\n/g' | sort | uniq

That assumes you don't have any files with spaces in their names or anything else completely reasonable like that...

Steve Losh
Well luckily I don't have filenames with spaces, so this worked pretty good! Thanks!