From dbeba8a0f0257a4233d129e6622f2af3027f9b68 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Mon, 25 May 2009 01:44:38 +0200 Subject: [PATCH 1/4] Deal with invalid timezones in extra commiter --- git_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git_handler.py b/git_handler.py index efe8f8111f..afea5dbe46 100644 --- a/git_handler.py +++ b/git_handler.py @@ -247,8 +247,11 @@ class GitHandler(object): if 'committer' in extra: # fixup timezone (name_timestamp, timezone) = extra['committer'].rsplit(' ', 1) - timezone = format_timezone(-int(timezone)) - commit['committer'] = '%s %s' % (name_timestamp, timezone) + try: + timezone = format_timezone(-int(timezone)) + commit['committer'] = '%s %s' % (name_timestamp, timezone) + except ValueError: + self.ui.warn(_("Ignoring committer in extra, invalid timezone in r%s: '%s'.\n") % (rev, timezone)) if 'encoding' in extra: commit['encoding'] = extra['encoding'] From 806623364a8f97a9e19548f0124ce1e22d3cf424 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Mon, 25 May 2009 04:20:44 +0200 Subject: [PATCH 2/4] Make it possible to limit what branches are imported --- git_handler.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git_handler.py b/git_handler.py index afea5dbe46..df18020985 100644 --- a/git_handler.py +++ b/git_handler.py @@ -57,6 +57,8 @@ class GitHandler(object): else: self.gitdir = self.repo.join('git') + self.importbranch = ui.config('git', 'importbranch') + self.init_if_missing() self.load_git() self.load_map() @@ -494,6 +496,9 @@ class GitHandler(object): if remote_name: todo = self.git.remote_refs(remote_name).values()[:] + elif self.importbranch: + branches = self.importbranch.split(',') + todo = [self.git.ref(i.strip()) for i in branches] else: todo = self.git.heads().values()[:] From 52121ac4b3d337345efe3f0f414b80648acabf63 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Tue, 26 May 2009 01:16:28 +0200 Subject: [PATCH 3/4] export: be more clean in what we're doing --- git_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_handler.py b/git_handler.py index df18020985..0bddb5d4ee 100644 --- a/git_handler.py +++ b/git_handler.py @@ -197,7 +197,7 @@ class GitHandler(object): return dict(filter(is_local_head, refs.items())) def export_git_objects(self): - self.ui.status(_("exporting git objects\n")) + self.ui.status(_("importing Hg objects into Git\n")) total = len(self.repo.changelog) magnitude = int(math.log(total, 10)) + 1 if total else 1 for i, rev in enumerate(self.repo.changelog): From f046c4d85b729eb0aa13c90847208d1ed3f11e2b Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Tue, 26 May 2009 01:43:55 +0200 Subject: [PATCH 4/4] only update bookmarks if importing from a remote --- git_handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git_handler.py b/git_handler.py index 0bddb5d4ee..912c413908 100644 --- a/git_handler.py +++ b/git_handler.py @@ -530,8 +530,9 @@ class GitHandler(object): self.import_git_commit(commit) else: self.pseudo_import_git_commit(commit) - - self.update_hg_bookmarks(remote_name) + + if remote_name: + self.update_hg_bookmarks(remote_name) def update_hg_bookmarks(self, remote_name): try: