Skip to content

Instantly share code, notes, and snippets.

@0x5742
Created July 19, 2015 12:00
Show Gist options
  • Select an option

  • Save 0x5742/adbd503331f321e85a87 to your computer and use it in GitHub Desktop.

Select an option

Save 0x5742/adbd503331f321e85a87 to your computer and use it in GitHub Desktop.
mercurial: connecting two related repositories
# This is how to fix things if you somehow manage to end up with two
# repositories for the same project, where the last changeset in the
# old repo should be the parent of the first changeset in the new one.
# I needed to do this for Schism Tracker at one point. No idea how I
# mangled it, but here's what I did.
# (A tip of the hat owed to #mercurial on Freenode for helping me.)
# FOREWARNING: this will alter all the changeset IDs in the new repo!
newid=$(hg -R newrepo log -r0 --template '{node}')
oldid=$(hg -R oldrepo log -rtip --template '{node}')
echo $newid $oldid > map
hg convert --splicemap map newrepo oldrepo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment