changeset 80:ebb9fb5e1705

core: make compatible with upcoming hg 1.9
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Wed, 25 May 2011 09:34:30 +0200
parents 15cf4a0a5ab6
children 39f1abc89152
files crecord/crecord_core.py
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/crecord/crecord_core.py
+++ b/crecord/crecord_core.py
@@ -122,14 +122,20 @@
                     ui.debug(fp.getvalue())
                     pfiles = {}
                     try:
-                        patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
+                        from mercurial import scmutil
+                        patch.internalpatch(ui, repo, fp, strip=1, files=pfiles,
                                             eolmode=None)
-                    except TypeError:  # backwards compatilibity with hg 1.1
-                        patch.internalpatch(fp, ui, 1, repo.root, files=pfiles)
-                    try:
-                        cmdutil.updatedir(ui, repo, pfiles)
-                    except AttributeError:
-                        patch.updatedir(ui, repo, pfiles)
+                        scmutil.updatedir(ui, repo, pfiles)
+                    except ImportError:
+                        try:
+                            patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
+                                                eolmode=None)
+                        except TypeError:  # backwards compatilibity with hg 1.1
+                            patch.internalpatch(fp, ui, 1, repo.root, files=pfiles)
+                        try:
+                            cmdutil.updatedir(ui, repo, pfiles)
+                        except AttributeError:
+                            patch.updatedir(ui, repo, pfiles)
                 except patch.PatchError, err:
                     s = str(err)
                     if s: