diff hgext/transplant.py @ 7415:6163ef936a00

protocol: use changegroupsubset() if possible (issue1389) Due to the fix to the pull race, to avoid sending unnecessary changesets, use changegroupsubset if possible. This will increase the load on the server.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 25 Nov 2008 23:26:33 +0100
parents 87158be081b8
children 97253bcb44a8
line wrap: on
line diff
--- a/hgext/transplant.py	Tue Nov 25 16:24:22 2008 -0600
+++ b/hgext/transplant.py	Tue Nov 25 23:26:33 2008 +0100
@@ -461,13 +461,16 @@
     def getremotechanges(repo, url):
         sourcerepo = ui.expandpath(url)
         source = hg.repository(ui, sourcerepo)
-        incoming = repo.findincoming(source, force=True)
+        common, incoming, rheads = repo.findcommonincoming(source, force=True)
         if not incoming:
             return (source, None, None)
 
         bundle = None
         if not source.local():
-            cg = source.changegroup(incoming, 'incoming')
+            if source.capable('changegroupsubset'):
+                cg = source.changegroupsubset(incoming, rheads, 'incoming')
+            else:
+                cg = source.changegroup(incoming, 'incoming')
             bundle = changegroup.writebundle(cg, None, 'HG10UN')
             source = bundlerepo.bundlerepository(ui, repo.root, bundle)