Commits

Sean Farley committed 658263c

Fixed more bugs and it seems to be working fully with 1.9. Completely punted on
backwards compatibility, though.

  • Participants
  • Parent commits b4bfdc6

Comments (0)

Files changed (1)

     # updatedir moved from patch to cmdutil in hg 1.7
     if hasattr(patch, 'updatedir'):
         patch.updatedir(*args, **kwargs)
-    else:
+    elif hasattr(cmdutil, 'updatedir'):
         cmdutil.updatedir(*args, **kwargs)
 
 class attic:
 
     def haschanges (self, repo, pats=[], opts={}):
         """checks if repository has changes or not"""
-        return list(patch.diff(repo, match = cmdutil.match(repo, pats, opts), opts = self.diffopts(opts))) != []
+        return list(patch.diff(repo, match = scmutil.match(repo[None], pats, opts), opts = self.diffopts(opts))) != []
 
     def available(self):
         '''reads all available patches from the attic dir
                 adopts['reverse'] = True
             return orig(*adargs, **adopts)
 
-        epo = extensions.wrapfunction(patch, 'externalpatch', epwrapper)
+        if hasattr(patch, '_externalpatch'):
+          epo = extensions.wrapfunction(patch, '_externalpatch', epwrapper)
+        else:
+          epo = extensions.wrapfunction(patch, 'externalpatch', epwrapper)
         ado = extensions.wrapfunction(patch, 'applydiff', adwrapper)
-        files, success = {}, True
+        files, success = set(), True
         try:
             try:
-                fuzz = patch.patch(self.join(patchfile), self.ui, strip = 1,
-                                   cwd = repo.root, files = files)
+                fuzz = patch.patch(self.ui, repo, self.join(patchfile), strip = 1,
+                                   files = files)
                 updatedir(self.ui, repo, files, similarity = sim/100.)
             except Exception, inst:
                 self.ui.note(str(inst) + '\n')
             fp.close()
 
         def applydiff(name):
-            files = {}
-            patch.patch(self.join(patchfile), self.ui, strip=1, files=files)
-            files2 = {}
-            for k in files.keys():
-                files2[k.strip('\r')]=files[k]
-            updatedir(self.ui, repo, files2, similarity=sim/100.)
+            files = set()
+            patch.patch(self.ui, repo, self.join(patchfile), strip=1, files=files)
+            updatedir(self.ui, repo, files, similarity=sim/100.)
         opener = scmutil.opener('.hg/attic')
         smo = extensions.wrapfunction(simplemerge, 'simplemerge', smwrapper)
         quiet = self.ui.quiet
             if msg and msg[-1] != '\n':
                 msg += '\n'
             fp.write(msg)
-        m = cmdutil.match(repo, pats, opts)
+        m = scmutil.match(repo[None], pats, opts)
         chunks = patch.diff(repo, match = m, opts = self.diffopts(opts))
         for chunk in chunks:
             fp.write(chunk)
         there isn't a patch applied'''
 
         # find added files in the user's chosen set
-        m = cmdutil.match(repo, pats, opts)
+        m = scmutil.match(repo[None], pats, opts)
         added = repo.status(match=m)[1]
 
         revertopts = { 'include': opts.get('include'),
         data = patch.extract(ui, open(s.join(s.applied), 'r'))
         tmpname, message, user, date, branch, nodeid, p1, p2 = data
         os.unlink(tmpname)
-    msg = cmdutil.logmessage(opts)
+    msg = cmdutil.logmessage(ui, opts)
     if not msg:
         msg = message
     if opts.get('edit'):
             changes = repo.status(match = match)[:3]
             modified, added, removed = changes
             files = modified + added + removed
-            match = cmdutil.matchfiles(repo, files)
+            match = scmutil.matchfiles(repo, files)
         diffopts = repo.attic.diffopts( {'git':True, 'nodates':True})
         chunks = patch.diff(repo, repo.dirstate.parents()[0], match = match,
                             changes = changes, opts = diffopts)