Mercurial > evolve
diff hgext/evolve.py @ 1632:498329a3c900 stable
evolve: Fix crash when reading docstring
Before this patch, hg evolve --divergent could crash when looking
for docstring of function of merge.update. We were checking the
docstring to work properly with older version of Mercurial. It
could crash if an extension would wrap merge.update without
keeping the docstring. This patch fixes the crash.
author | Juntao Li <juntaoli@fb.com> |
---|---|
date | Thu, 17 Mar 2016 17:03:51 -0700 |
parents | d49f4ad04fbd |
children | 9bcb24c3ba8d |
line wrap: on
line diff
--- a/hgext/evolve.py Sat Mar 12 13:15:28 2016 +0800 +++ b/hgext/evolve.py Thu Mar 17 17:03:51 2016 -0700 @@ -1998,7 +1998,14 @@ hg.update(repo, divergent.rev()) repo.ui.note(_('merging divergent changeset\n')) if progresscb: progresscb() - if 'partial' in merge.update.__doc__: + try: + stats = merge.update(repo, + other.node(), + branchmerge=True, + force=False, + ancestor=base.node(), + mergeancestor=True) + except TypeError: # Mercurial < 43c00ca887d1 (3.7) stats = merge.update(repo, other.node(), @@ -2007,13 +2014,6 @@ partial=None, ancestor=base.node(), mergeancestor=True) - else: - stats = merge.update(repo, - other.node(), - branchmerge=True, - force=False, - ancestor=base.node(), - mergeancestor=True) hg._showstats(repo, stats) if stats[3]: