views:

55

answers:

1

I have a folder in a mercurial repository, that I want to copy to another mercurial repository, but with all the changes that I made to this folder, and without losing the all version control that I did on this folder.

Is that possible to do with mercurial?

A: 

I think if the changesets relating to files in that directory refer ONLY to files in that directory you could use hg export/import to achieve that. First identify all the changesets for those files, then export them, then import them... here's shell script to do the first part:

for i in $(hg log -M --template="{node}\n" directory)
do 
  hg export -r $i -o "$(date '+%Y%m%d%H%M%S')_%H"
done

then move those files to your new repo and do hg import on each one in turn.

IF your changesets don't include other files then this will work... even then you might find a lot of rejects and it doesn't include the original commit messages or the merges changesets (obviously).

nic ferrier