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