changeset 38615:4d5fb4062f0b

remotenames: synchronise remotenames after push also Earlier we use to pull remotenames information from the server in case of pull and clone only. This patch adds logic to push also command to pull remotenames information. This will help us in keeping the remotenames more upto date where there are a lot people changing state of branches and bookmarks at the server. Differential Revision: https://phab.mercurial-scm.org/D2874
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 15 Mar 2018 17:37:03 +0530
parents 5cbcbe51d38d
children c44ae5997869
files mercurial/exchange.py tests/test-logexchange.t
diffstat 2 files changed, 59 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Sun Jun 10 20:45:13 2018 +0900
+++ b/mercurial/exchange.py	Thu Mar 15 17:37:03 2018 +0530
@@ -531,6 +531,9 @@
         _pushobsolete(pushop)
         _pushbookmark(pushop)
 
+    if repo.ui.configbool('experimental', 'remotenames'):
+        logexchange.pullremotenames(repo, remote)
+
     return pushop
 
 # list of steps to perform discovery before push
--- a/tests/test-logexchange.t	Sun Jun 10 20:45:13 2018 +0900
+++ b/tests/test-logexchange.t	Thu Mar 15 17:37:03 2018 +0530
@@ -339,3 +339,59 @@
      default/bar               6:87d6d6676308
      default/foo               3:62615734edd5
    * foo                       8:3e1487808078
+
+Testing the remotenames sychronization during `hg push`
+-------------------------------------------------------
+
+  $ cd ../server/
+  $ hg bookmark foo
+  moving bookmark 'foo' forward from 62615734edd5
+
+After the push, default/foo should move to rev 8
+  $ cd ../client/
+  $ hg push
+  pushing to ssh://user@dummy/server
+  searching for changes
+  no changes found
+  [1]
+  $ hg log -Gr 'remotenames()'
+  @  changeset:   8:3e1487808078
+  :  branch:      wat
+  :  bookmark:    foo
+  :  tag:         tip
+  :  remote bookmark:  default/foo
+  :  hoisted name:  foo
+  :  remote branch:  $TESTTMP/server2/wat
+  :  remote branch:  default/wat
+  :  parent:      4:aa98ab95a928
+  :  user:        test
+  :  date:        Thu Jan 01 00:00:00 1970 +0000
+  :  summary:     added bar
+  :
+  : o  changeset:   7:ec2426147f0e
+  : |  remote branch:  $TESTTMP/server2/default
+  : |  remote branch:  default/default
+  : |  user:        test
+  : |  date:        Thu Jan 01 00:00:00 1970 +0000
+  : |  summary:     Added h
+  : |
+  : o  changeset:   6:87d6d6676308
+  :/   remote bookmark:  $TESTTMP/server2/bar
+  :    remote bookmark:  default/bar
+  :    hoisted name:  bar
+  :    user:        test
+  :    date:        Thu Jan 01 00:00:00 1970 +0000
+  :    summary:     Added g
+  :
+  o  changeset:   3:62615734edd5
+  |  remote bookmark:  $TESTTMP/server2/foo
+  ~  user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     Added d
+  
+  $ hg bookmarks
+     $TESTTMP/server2/bar 6:87d6d6676308
+     $TESTTMP/server2/foo 3:62615734edd5
+     default/bar               6:87d6d6676308
+     default/foo               8:3e1487808078
+   * foo                       8:3e1487808078