Mercurial > hg > hg-git
changeset 691:c99941ff2d28
overlayrevlog: handle root commits correctly
Previously, we'd try to access commit.parents[0] and fail. Now, check for
commit.parents being empty and return what Mercurial thinks is a repository
root in that case.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 25 Feb 2014 00:23:12 -0800 |
parents | aa8519daf037 |
children | 6ab17ae0c834 |
files | hggit/overlay.py tests/test-incoming.t |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/overlay.py +++ b/hggit/overlay.py @@ -192,6 +192,9 @@ return self.base.parents(n) commit = self.repo.handler.git.get_object(_maybehex(n)) + if not commit.parents: + return [nullid, nullid] + def gitorhg(n): hn = self.repo.handler.map_hg_get(hex(n)) if hn is not None:
old mode 100755 new mode 100644 --- a/tests/test-incoming.t +++ b/tests/test-incoming.t @@ -9,6 +9,15 @@ $ fn_git_commit -m "add alpha" $ cd .. + $ hg init hgrepo-empty + $ hg -R hgrepo-empty incoming gitrepo | grep -v 'no changes found' | grep -v 'bookmark:' + comparing with gitrepo + changeset: 0:7eeab2ea75ec + user: test <test@example.org> + date: Mon Jan 01 00:00:10 2007 +0000 + summary: add alpha + + $ hg clone gitrepo hgrepo | grep -v '^updating' importing git objects into hg 1 files updated, 0 files merged, 0 files removed, 0 files unresolved