Commits

Angel Ezquerra committed c0b26bc

Really make extension compatible with mercurial 2.3

The 1c632c6698fd fix was incomplete. hg incoming was broken, and cloning from a
local repository would not properly transfer the projrc file.

Comments (0)

Files changed (1)

     except:
         # Non local repos have no root property
         remotepath = other.url()
+        if remotepath.startswith('file:'):
+            remotepath = remotepath[5:]
 
     if '*' not in projrcserverset and \
             not findpatternmatch(remotepath, projrcserverset)[0] and \
     if data != "":
         # Compare the old projrc with the new one
         try:
+            if hasattr(localrepo, 'localpeer'):
+                # hg >= 2.3
+                repo = repo.local()
             olddata = readcurrentprojrc(repo)
 
             if olddata != data:
     if uprev[0]:
         dstrepo = dst
         if hasattr(localrepo, 'localpeer'):
+            # hg >= 2.3
             dstrepo = dst.local()
         origupdate(dstrepo, uprev[0])
     return src, dst
     res = orig(ui, repo, srcpath, *args, **kwargs)
 
     expandedpath = ui.expandpath(srcpath)
-    other = hg.repository(ui, expandedpath)
+
+    if hasattr(localrepo, 'localpeer'):
+        # hg >= 2.3
+        other = hg.peer(repo, {}, expandedpath)
+        localother = other.local()
+        if localother is not None:
+            other = localother
+    else:
+        # hg < 2.3
+        other = hg.repository(ui, expandedpath)
 
     def mustupdateonincoming():
         default = 'false'