# HG changeset patch # User Mads Kiilerich # Date 1386700237 -3600 # Node ID 8f5ecadb7ec142b6331e6bb92d8dfd3db8b8920a # Parent d80689aa938d3a02a3a78e020a32614db3d2be13 pull requests: preserve ordering of peer-selected branches diff -r d80689aa938d -r 8f5ecadb7ec1 kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py Tue Dec 10 19:30:37 2013 +0100 +++ b/kallithea/controllers/pullrequests.py Tue Dec 10 19:30:37 2013 +0100 @@ -91,15 +91,15 @@ branch_rev = safe_str(branch_rev) # not restricting to merge() would also get branch point and be better # (especially because it would get the branch point) ... but is currently too expensive - otherbranches = {} + peerbranches = set() for i in repo._repo.revs( - "sort(parents(branch(id(%s)) and merge()) - branch(id(%s)))", + "sort(parents(branch(id(%s)) and merge()) - branch(id(%s)), -rev)", branch_rev, branch_rev): - cs = repo.get_changeset(i) - otherbranches[cs.branch] = repo.get_changeset(cs.branch).raw_id - for abranch, node in otherbranches.iteritems(): - selected = 'branch:%s:%s' % (abranch, node) - peers.append((selected, abranch)) + abranch = repo.get_changeset(i).branch + if abranch not in peerbranches: + n = 'branch:%s:%s' % (abranch, repo.get_changeset(abranch).raw_id) + peers.append((n, abranch)) + peerbranches.add(abranch) selected = None