<div dir="auto"><div>That seems like a tricky case. Could we get test coverage?<div dir="auto"><br></div><div dir="auto">Mads</div><br><div class="gmail_extra"><br><div class="gmail_quote">On 9 Jul 2017 3:29 am, "Andrew Shadura" <<a href="mailto:andrew@shadura.me">andrew@shadura.me</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Andrew Shadura <<a href="mailto:andrew@shadura.me">andrew@shadura.me</a>><br>
# Date 1499563683 18000<br>
#      Sat Jul 08 20:28:03 2017 -0500<br>
# Node ID 2e81b5a48ffb50115e25b9b9eedb95<wbr>9aeedcecda<br>
# Parent  cf3d4094791c2108392d7f76d958cd<wbr>08a9c523f3<br>
git: don't show errors when two heads are unrelated<br>
<br>
When two heads belong to different parallel timelines, git merge-base exits<br>
with an error code (this isn't mentioned in the manual page). It's better to<br>
just say to the user there are no changesets to pull, which gives the user a<br>
hint they can't do what they're trying to do, instead of just a word "error",<br>
which is confusing and not helpful at all.<br>
<br>
diff --git a/kallithea/controllers/<wbr>compare.py b/kallithea/controllers/<wbr>compare.py<br>
--- a/kallithea/controllers/<wbr>compare.py<br>
+++ b/kallithea/controllers/<wbr>compare.py<br>
@@ -45,6 +45,7 @@ from kallithea.model.db import Repositor<br>
 from kallithea.lib.diffs import LimitedDiffContainer<br>
 from kallithea.controllers.<wbr>changeset import _ignorews_url, _context_url<br>
 from kallithea.lib.graphmod import graph_data<br>
+from kallithea.lib.vcs.exceptions import RepositoryError<br>
<br>
 log = logging.getLogger(__name__)<br>
<br>
@@ -161,10 +162,13 @@ class CompareController(<wbr>BaseRepoControll<br>
                 )<br>
                 other_changesets = [org_repo.get_changeset(cs)<br>
                               for cs in re.findall(r'[0-9a-fA-F]{40}', so)]<br>
-                so, se = org_repo.run_git_command(<br>
-                    ['merge-base', org_rev, other_rev]<br>
-                )<br>
-                ancestors = [re.findall(r'[0-9a-fA-F]{40}'<wbr>, so)[0]]<br>
+                try:<br>
+                    so, se = org_repo.run_git_command(<br>
+                        ['merge-base', org_rev, other_rev]<br>
+                    )<br>
+                except RepositoryError:<br>
+                    other_changesets = []<br>
+                ancestors = [re.findall(r'[0-9a-fA-F]{40}'<wbr>, so)[:1]]<br>
             org_changesets = []<br>
<br>
         else:<br>
______________________________<wbr>_________________<br>
kallithea-general mailing list<br>
<a href="mailto:kallithea-general@sfconservancy.org">kallithea-general@<wbr>sfconservancy.org</a><br>
<a href="https://lists.sfconservancy.org/mailman/listinfo/kallithea-general" rel="noreferrer" target="_blank">https://lists.sfconservancy.<wbr>org/mailman/listinfo/<wbr>kallithea-general</a><br>
</blockquote></div><br></div></div></div>