Mercurial > hg > hg-git
changeset 40:f5b000ec7100
added gclear command to remove all the git data
author | Scott Chacon <schacon@gmail.com> |
---|---|
date | Tue, 28 Apr 2009 16:56:05 -0700 (2009-04-28) |
parents | 173e738d0da4 |
children | 12d4f99c0702 |
files | TODO.txt __init__.py git_handler.py |
diffstat | 3 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO.txt +++ b/TODO.txt @@ -5,13 +5,14 @@ * switch object mapping to hg->git since the many to one is that direction * file modes * gclear - clear out all the git data +* explicit file renames PUSH ========== * update 'remote' references after push confirmation * push confirmation? is there extra data after the packfile upload? -* output something after process is complete +* output something after process is complete (master -> master etc) * convert tags to git
--- a/__init__.py +++ b/__init__.py @@ -68,6 +68,11 @@ git.remote_show(nick) else: repo.ui.warn(_("unrecognized command to gremote\n")) + +def gclear(ui, repo): + repo.ui.status(_("clearing out the git cache data\n")) + git = GitHandler(repo, ui) + git.clear() def gfetch(ui, repo): dest_repo.ui.status(_("pulling from git url\n")) @@ -86,4 +91,6 @@ _('hg gfetch remote')), "gremote": (gremote, [], _('hg gremote add remote (url)')), + "gclear": + (gclear, [], _('Clears out the Git cached data')), }
--- a/git_handler.py +++ b/git_handler.py @@ -196,7 +196,7 @@ commit['author'] = ctx.user() + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone) message = ctx.description() commit['message'] = ctx.description() - commit['message'] += "\n\n--HG EXTRAS--\n" + commit['message'] += "\n\n--HG--\n" commit['message'] += "branch : " + ctx.branch() + "\n" commit['parents'] = [] @@ -472,6 +472,20 @@ # if its not git or git+ssh, try a local url.. return SubprocessGitClient(), uri + def clear(self): + git_dir = self.repo.join('git') + mapfile = self.repo.join('git-mapfile') + if os.path.exists(git_dir): + for root, dirs, files in os.walk(git_dir, topdown=False): + for name in files: + os.remove(os.path.join(root, name)) + for name in dirs: + os.rmdir(os.path.join(root, name)) + os.rmdir(git_dir) + if os.path.exists(mapfile): + os.remove(mapfile) + + '' """ Tarjan's algorithm and topological sorting implementation in Python