Commits

Anonymous committed ed3988f

Catch up to updatedir api change in hg 1.7 (retain backwards
compatibility for < 1.7).

  • Participants
  • Parent commits 6f4b12b

Comments (0)

Files changed (1)

 from mercurial import extensions, fancyopts, simplemerge
 from mercurial.node import hex, bin
 import cStringIO, os, re, errno, tempfile, sys
-
 normname = util.normpath
+def updatedir(*args, **kwargs):
+    # updatedir moved from patch to cmdutil in hg 1.7
+    if hasattr(patch, 'updatedir'):
+        patch.updatedir(*args, **kwargs)
+    else:
+        cmdutil.updatedir(*args, **kwargs)
 
 class attic:
     """encapsulates all attic functionality that is dependant on state"""
-
     def __init__(self, ui, path, patchdir=None):
         """initializes everything, this was copied from mq"""
         self.basepath = path
             try:
                 fuzz = patch.patch(self.join(patchfile), self.ui, strip = 1,
                                    cwd = repo.root, files = files)
-                patch.updatedir(self.ui, repo, files, similarity = sim/100.)
+                updatedir(self.ui, repo, files, similarity = sim/100.)
             except Exception, inst:
                 self.ui.note(str(inst) + '\n')
                 if not self.ui.verbose:
             files2 = {}
             for k in files.keys():
                 files2[k.strip('\r')]=files[k]
-            patch.updatedir(self.ui, repo, files2, similarity=sim/100.)
-
+            updatedir(self.ui, repo, files2, similarity=sim/100.)
         opener = util.opener('.hg/attic')
         smo = extensions.wrapfunction(simplemerge, 'simplemerge', smwrapper)
         quiet = self.ui.quiet