Changeset - f32c68450266
[Not reviewed]
default
0 1 0
Mads Kiilerich - 10 years ago 2015-06-19 18:06:24
madski@unity3d.com
compare: backout 51c4d2e74898 to fix ancestor calculation to empty repository

This case can not just be simplified as I thought it could.

Mercurial 3.4 has
d2de20e1451f 'revset: extend fullreposet to make "null" revision magically appears in set'
Which makes
ancestor(id(0000000000),1)
'correctly' return the null revision as ancestor.

We can however not rely on that when supporting Mercurial 3.3.
1 file changed with 13 insertions and 9 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/compare.py
Show inline comments
 
@@ -70,7 +70,7 @@ class CompareController(BaseRepoControll
 
        :param other_rev: revision we want out compare to be made on other_repo
 
        """
 
        ancestor = None
 
        if org_rev == other_rev or org_repo.EMPTY_CHANGESET in (org_rev, other_rev):
 
        if org_rev == other_rev:
 
            org_changesets = []
 
            other_changesets = []
 
            ancestor = org_rev
 
@@ -88,14 +88,18 @@ class CompareController(BaseRepoControll
 
            else:
 
                hgrepo = other_repo._repo
 

	
 
            ancestors = hgrepo.revs("ancestor(id(%s), id(%s))", org_rev, other_rev)
 
            if ancestors:
 
                # FIXME: picks arbitrary ancestor - but there is usually only one
 
                try:
 
                    ancestor = hgrepo[ancestors.first()].hex()
 
                except AttributeError:
 
                    # removed in hg 3.2
 
                    ancestor = hgrepo[ancestors[0]].hex()
 
            if org_repo.EMPTY_CHANGESET in (org_rev, other_rev):
 
                # work around unexpected behaviour in Mercurial < 3.4
 
                ancestor = org_repo.EMPTY_CHANGESET
 
            else:
 
                ancestors = hgrepo.revs("ancestor(id(%s), id(%s))", org_rev, other_rev)
 
                if ancestors:
 
                    # FIXME: picks arbitrary ancestor - but there is usually only one
 
                    try:
 
                        ancestor = hgrepo[ancestors.first()].hex()
 
                    except AttributeError:
 
                        # removed in hg 3.2
 
                        ancestor = hgrepo[ancestors[0]].hex()
 

	
 
            other_revs = hgrepo.revs("ancestors(id(%s)) and not ancestors(id(%s)) and not id(%s)",
 
                                     other_rev, org_rev, org_rev)
0 comments (0 inline, 0 general)