diff -r 744d1c874a59 -r 2ea6e42ed15e mercurial/remotenames.py --- a/mercurial/remotenames.py Thu Oct 05 01:31:53 2017 +0530 +++ b/mercurial/remotenames.py Thu Nov 09 12:10:03 2017 +0530 @@ -64,6 +64,12 @@ # version '0' represents the very initial version of the storage format f.write('0\n\n') + olddata = set(readremotenamefile(repo, nametype)) + # re-save the data from a different remote than this one. + for node, oldpath, rname in sorted(olddata): + if oldpath != remotepath: + f.write('%s\0%s\0%s\n' % (node, oldpath, rname)) + for name, node in sorted(names.iteritems()): if nametype == "branches": for n in node: