Mercurial > hg-git
diff hggit/__init__.py @ 298:6ad6945b6629
pull: make it possible to un-wedge the repo after stripping git revs
This adds a new command, which is inelegant, but it lets you safely
pick up pulling fairly quickly.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Thu, 25 Mar 2010 20:24:00 -0500 |
parents | a90fe3e8a8c3 |
children | eec31dee258e |
line wrap: on
line diff
--- a/hggit/__init__.py Thu Mar 25 20:23:00 2010 -0500 +++ b/hggit/__init__.py Thu Mar 25 20:24:00 2010 -0500 @@ -81,6 +81,16 @@ git = GitHandler(repo, ui) git.clear() +def git_cleanup(ui, repo): + new_map = [] + for line in repo.opener(GitHandler.mapfile): + gitsha, hgsha = line.strip().split(' ', 1) + if hgsha in repo: + new_map.append('%s %s\n' % (gitsha, hgsha)) + f = repo.opener(GitHandler.mapfile, 'wb') + map(f.write, new_map) + ui.status(_('git commit map cleaned\n')) + cmdtable = { "gimport": (gimport, [], _('hg gimport')), @@ -88,4 +98,6 @@ (gexport, [], _('hg gexport')), "gclear": (gclear, [], _('Clears out the Git cached data')), + "git-cleanup": (git_cleanup, [], _( + "Cleans up git repository after history editing")) }