views:

539

answers:

1

I have two unrelated repositories 'public' and 'develop':

prj/
  public/
  develop/

'develop' has lots of commits, 'cause here is where I work. Maybe even multiple heads From time to time I want publish a snapshot of the development repository.

From the public folder I could do this:

>hg pull -f ../develop
>hg merge
>hg commit -m "alpha2"

But this will also pull the complete changeset history from 'develop' to 'public' (which is not what I want).

I could also delete all files from 'public', except for the '.hg' subfolder. Then manually copy all files from the 'develop' directory and do a

>hg commit -m "alpha2"

But then I have to 'add' new files, 'remove' obsolete files and 'rename' moved files again.

Using the -A option with commit would blindly add/remove all files, even if they were uncontrolled in the 'development' repository.

There must be a more efficient way to do this ;-)

+2  A: 

I'd suggest you just move over the full history, but if you can't stomach that for some reason then you could do any of these things:

  1. use http://mercurial.selenic.com/wiki/ConcatenatingChangesets to join all the changesets from develop into a single resulting changeset in public -or-
  2. delete all files in public, make a 'hg archive' in develop, and expand it in public -- that will get you controlled files only -or
  3. use 'hg manifest' in develop to power xargs to move over only files you want -or-
  4. do a 'hg diff -r last-changeset-in-public -r tip' in develop, and then apply that resulting diff using 'hg import' in public and you'll have the full changes as a single changeset in public

Any of those should do the same thing, but all of them are a little ugly because, in general, throwing away history is hard to do.

Ry4an