This revision was automatically updated to reflect the committed changes.
Closed by commit rHG62a428bf6359: logexchange: introduce helper function to get 
remote path name (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1755?vs=5144&id=5520

REVISION DETAIL
  https://phab.mercurial-scm.org/D1755

AFFECTED FILES
  mercurial/logexchange.py
  tests/test-logexchange.t

CHANGE DETAILS

diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t
--- a/tests/test-logexchange.t
+++ b/tests/test-logexchange.t
@@ -57,14 +57,14 @@
   $ cat .hg/logexchange/bookmarks
   0
   
-  87d6d66763085b629e6d7ed56778c79827273022\x00file:$TESTTMP/server\x00bar (esc)
-  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00file:$TESTTMP/server\x00foo (esc)
+  87d6d66763085b629e6d7ed56778c79827273022\x00default\x00bar (esc)
+  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00default\x00foo (esc)
 
   $ cat .hg/logexchange/branches
   0
   
-  ec2426147f0e39dbc9cef599b066be6035ce691d\x00file:$TESTTMP/server\x00default 
(esc)
-  3e1487808078543b0af6d10dadf5d46943578db0\x00file:$TESTTMP/server\x00wat (esc)
+  ec2426147f0e39dbc9cef599b066be6035ce691d\x00default\x00default (esc)
+  3e1487808078543b0af6d10dadf5d46943578db0\x00default\x00wat (esc)
 
 Making a new server
 -------------------
@@ -94,15 +94,15 @@
   $ cat .hg/logexchange/bookmarks
   0
   
-  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00file:$TESTTMP/server\x00foo (esc)
-  87d6d66763085b629e6d7ed56778c79827273022\x00file:$TESTTMP/server\x00bar (esc)
-  87d6d66763085b629e6d7ed56778c79827273022\x00file:$TESTTMP/server2\x00bar 
(esc)
-  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00file:$TESTTMP/server2\x00foo 
(esc)
+  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00default\x00foo (esc)
+  87d6d66763085b629e6d7ed56778c79827273022\x00default\x00bar (esc)
+  87d6d66763085b629e6d7ed56778c79827273022\x00$TESTTMP/server2\x00bar (esc)
+  62615734edd52f06b6fb9c2beb429e4fe30d57b8\x00$TESTTMP/server2\x00foo (esc)
 
   $ cat .hg/logexchange/branches
   0
   
-  3e1487808078543b0af6d10dadf5d46943578db0\x00file:$TESTTMP/server\x00wat (esc)
-  ec2426147f0e39dbc9cef599b066be6035ce691d\x00file:$TESTTMP/server\x00default 
(esc)
-  ec2426147f0e39dbc9cef599b066be6035ce691d\x00file:$TESTTMP/server2\x00default 
(esc)
-  3e1487808078543b0af6d10dadf5d46943578db0\x00file:$TESTTMP/server2\x00wat 
(esc)
+  3e1487808078543b0af6d10dadf5d46943578db0\x00default\x00wat (esc)
+  ec2426147f0e39dbc9cef599b066be6035ce691d\x00default\x00default (esc)
+  ec2426147f0e39dbc9cef599b066be6035ce691d\x00$TESTTMP/server2\x00default (esc)
+  3e1487808078543b0af6d10dadf5d46943578db0\x00$TESTTMP/server2\x00wat (esc)
diff --git a/mercurial/logexchange.py b/mercurial/logexchange.py
--- a/mercurial/logexchange.py
+++ b/mercurial/logexchange.py
@@ -11,6 +11,7 @@
 from .node import hex
 
 from . import (
+    util,
     vfs as vfsmod,
 )
 
@@ -94,14 +95,38 @@
     finally:
         wlock.release()
 
+def activepath(repo, remote):
+    """returns remote path"""
+    local = None
+    # is the remote a local peer
+    local = remote.local()
+
+    # determine the remote path from the repo, if possible; else just
+    # use the string given to us
+    rpath = remote
+    if local:
+        rpath = remote._repo.root
+    elif not isinstance(remote, str):
+        rpath = remote._url
+
+    # represent the remotepath with user defined path name if exists
+    for path, url in repo.ui.configitems('paths'):
+        # remove auth info from user defined url
+        url = util.removeauth(url)
+        if url == rpath:
+            rpath = path
+            break
+
+    return rpath
+
 def pullremotenames(localrepo, remoterepo):
     """
     pulls bookmarks and branches information of the remote repo during a
     pull or clone operation.
     localrepo is our local repository
     remoterepo is the peer instance
     """
-    remotepath = remoterepo.url()
+    remotepath = activepath(localrepo, remoterepo)
     bookmarks = remoterepo.listkeys('bookmarks')
     # on a push, we don't want to keep obsolete heads since
     # they won't show up as heads on the next pull, so we



To: pulkit, #hg-reviewers, durin42
Cc: durin42, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to