# HG changeset patch # User Scott Chacon # Date 1241038522 25200 # Node ID 5185af4e649afdb7ddd8573c9ff88bbb1f00ca3a # Parent 4b1fa3d0fa8b915a7581e9b04eb864a4a1796222 hg gfetch now works diff --git a/__init__.py b/__init__.py --- a/__init__.py +++ b/__init__.py @@ -73,10 +73,12 @@ 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")) - + +def gfetch(ui, repo, remote_name='origin'): + repo.ui.status(_("pulling from git url\n")) + git = GitHandler(repo, ui) + git.fetch(remote_name) + commands.norepo += " gclone" cmdtable = { "gclone": diff --git a/git_handler.py b/git_handler.py --- a/git_handler.py +++ b/git_handler.py @@ -113,8 +113,9 @@ def fetch(self, remote_name): self.ui.status(_("fetching from : " + remote_name + "\n")) self.export_git_objects() - self.fetch_pack(remote_name) - self.import_git_objects(remote_name) + refs = self.fetch_pack(remote_name) + if refs: + self.import_git_objects(remote_name) self.save_map() def push(self, remote_name): @@ -386,7 +387,11 @@ refs = client.fetch_pack(path, determine_wants, graphwalker, f.write, sys.stdout.write) f.close() commit() - self.git.set_remote_refs(refs, remote_name) + if refs: + self.git.set_remote_refs(refs, remote_name) + else: + self.ui.status(_("nothing new on the server\n")) + return refs except: f.close() raise @@ -422,8 +427,9 @@ # import each of the commits, oldest first for csha in commits: - commit = convert_list[csha] - self.import_git_commit(commit) + if not self.map_hg_get(csha): + commit = convert_list[csha] + self.import_git_commit(commit) self.update_hg_bookmarks(remote_name)