Commits

Jannis Leidel committed 5ea01a2

Made it work on Mercurial >= 1.9.

Comments (0)

Files changed (1)

     except:
         pass
 
+try:
+    from distutils import log
+except ImportError:
+    log = None
+
 OLD_VERSIONS = ('1.0', '1.0.1', '1.0.2')
 
 if os.environ.get('HG_SETUPTOOLS_FORCE_CMD', False):
                 yield abs
         else:
             rev = None
-            match = cmdutil.match(repo, [], {}, default='relglob')
+            try:
+                match = cmdutil.match(repo, [], {}, default='relglob')
+            except:
+                # Probably mercurial 1.8+
+                from mercurial import scmutil 
+                match = scmutil.match(repo[None], [], {}, default='relglob')
+
             match.bad = lambda x, y: False
             for abs in repo[rev].walk(match):
                 if not rev and abs not in repo.dirstate:
                 if abs in excluded:
                     continue
                 yield abs
-    except:
+    except Exception, e:
+        if log:
+            log.warn("Error in setuptools_hg: %s" % e)
         # try calling hg command as a last resort
         find_files_with_cmd(dirname)