Patchwork D1601: clone: add support for storing remotenames while cloning

login
register
mail settings
Submitter phabricator
Date Dec. 6, 2017, 1:13 a.m.
Message ID <differential-rev-PHID-DREV-std2i53nmn6cytzuoqwu-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25962/
State Superseded
Headers show

Comments

phabricator - Dec. 6, 2017, 1:13 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If `experimental.remotenames` is set to True, we store the remotenames in case
  of `hg pull`. This patch adds that support to clone command also.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hg.py
  tests/test-remotenames.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-remotenames.t b/tests/test-remotenames.t
--- a/tests/test-remotenames.t
+++ b/tests/test-remotenames.t
@@ -4,6 +4,8 @@ 
   $ cat >> $HGRCPATH << EOF
   > [alias]
   > glog = log -G -T '{rev}:{node|short}  {desc}'
+  > [experimental]
+  > remotenames = True
   > EOF
 
 Making a server repo
@@ -43,25 +45,12 @@ 
 --------------------
 
   $ cd ..
-  $ hg init client
-  $ cd client
-  $ cat >> .hg/hgrc << EOF
-  > [experimental]
-  > remotenames = True
-  > EOF
 
-  $ hg pull ../server/
-  pulling from ../server/
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 9 changesets with 9 changes to 9 files (+1 heads)
-  adding remote bookmark bar
-  adding remote bookmark foo
-  new changesets 18d04c59bb5d:3e1487808078
-  (run 'hg heads' to see heads)
+  $ hg clone server client
+  updating to branch default
+  8 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+  $ cd client
   $ cat .hg/remotenames/bookmarks
   0
   
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -31,6 +31,7 @@ 
     merge as mergemod,
     node,
     phases,
+    remotenames,
     repoview,
     scmutil,
     sshpeer,
@@ -689,6 +690,9 @@ 
 
             destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone')
 
+            if ui.configbool('experimental', 'remotenames'):
+                remotenames.pullremotenames(destrepo, srcpeer)
+
             if update:
                 if update is not True:
                     checkout = srcpeer.lookup(update)