changeset 5185:c111d5db3713

evolve: drop 4.5 compatibility with `patch.extract` API
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 07 Mar 2020 02:03:28 +0700
parents 2ccd7c97ed59
children 4bac3454beef
files hgext3rd/evolve/cmdrewrite.py
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Sat Mar 07 01:43:40 2020 +0700
+++ b/hgext3rd/evolve/cmdrewrite.py	Sat Mar 07 02:03:28 2020 +0700
@@ -11,7 +11,6 @@
 
 from __future__ import absolute_import
 
-import contextlib
 import random
 
 from mercurial import (
@@ -219,14 +218,7 @@
 def _writepatch(ui, repo, old, fp):
     """utility function to use filestore and patchrepo to apply a patch to the
     repository with metadata being extracted from the patch"""
-    metadata = patch.extract(ui, fp)
-    if util.safehasattr(metadata, 'get'): # < hg-4.6
-        @contextlib.contextmanager
-        def patchcontext():
-            yield metadata
-        patchcontext = patchcontext()
-    else:
-        patchcontext = metadata
+    patchcontext = patch.extract(ui, fp)
     pold = old.p1()
 
     with patchcontext as metadata: