How to extract changes from unrevisioned repository

Matt Mackall mpm at selenic.com
Mon Jan 11 16:35:17 CST 2010


On Mon, 2010-01-11 at 14:06 -0800, Kyle Altendorf wrote:
> There is one person at work that I have been unable to convince to use
> Mercurial.  Not only is he not using revision control but the .hg
> folder has been deleted from his copies of the project.  I am trying
> to bring whatever changes were made in that uncontrolled copy back
> into the main repo.  The issue I am having is that as I try to find
> the 'parent' I am finding that certain changes have been cherry picked
> out of various changesets in the controlled project while ignoring
> other changes in the same or intermediate changesets.  The result is
> that I am having difficulty picking a single parent from which to try
> to merge the uncontrolled copy back in.

Wow. Is this going to be an ongoing problem or is he now seeking
employment in a non-engineering field?

> Is there some method for resolving this issue other than double
> checking every difference?  I could imagine a tool that would reverse
> every hunk in the repository and try to apply it to the uncontrolled
> copy to identify which changes had been applied but I assume that
> there would be numerous problems with that.  Any comments would be
> appreciated.

I've done this about half a dozen times with a copy of the Linux kernel
and about 3-10MB of local delta pulled out of useless incoherent CVS
histories. I pull a giant project-wide diff into a diff-aware editor
like Emacs and manually chop it into smaller patches. Then I drop them
all into mq, push them one by one, and throw out the ones that are
already in the tree. This tends to work well with the kernel as changes
are pretty well localized to drivers, filesystems, and architectures,
but for other trees, I'm sure it's a nightmare.

A while back, I posted a script to find the version of a file in history
that most nearly corresponded to a given file contents. You might find
it useful. Not sure how to find it though.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial mailing list