comparison hgext/narrow/narrowcommands.py @ 39356:c8e4eae84808

narrow: add server logic to send cg while widening without ellipsis Before this patch, if you try to widen a narrow clone without ellipsis enabled, it will be broken and the exchange.pull() done by tracked command to widen the clone will be no-op because no custom logic exists for this and server sees that we have all csets and it says `no changes found`. The widening with ellipsis send KILL for existing changegroups and send new changegroups because of the change in ellipsis hash, but we can prevent that in non-ellipsis cases. This patch adds server side logic to send the changegroups for the changesets which are on the client again with filelogs and manifests for the new includes. This is a very starting implementation and we send changegroups and manifests too while we can prevent them. Following things can definitely be improved in the logic this patch adds: 1) Send just the filelogs and treemanifests 2) Send the filelogs only for the additions in the include I tried 1) here but the code is coupled tightly and the way I was able to do that was hacking into the changegroup generation code in a very dirty way, like adding conditionals and preventing the yield. This patch also adds a 'widen' kwarg to prevent other commands except widening to go through that codepath. The test changes demonstrate that the new implementation is correct and fixes things. Differential Revision: https://phab.mercurial-scm.org/D4383
author Pulkit Goyal <pulkit@yandex-team.ru>
date Sun, 26 Aug 2018 20:20:34 +0300
parents f4d4bd8c8911
children 2b8adb7ca39a
comparison
equal deleted inserted replaced
39355:bca0546a44bf 39356:c8e4eae84808
284 def pullbundle2extraprepare_widen(orig, pullop, kwargs): 284 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
285 orig(pullop, kwargs) 285 orig(pullop, kwargs)
286 # The old{in,ex}cludepats have already been set by orig() 286 # The old{in,ex}cludepats have already been set by orig()
287 kwargs['includepats'] = newincludes 287 kwargs['includepats'] = newincludes
288 kwargs['excludepats'] = newexcludes 288 kwargs['excludepats'] = newexcludes
289 kwargs['widen'] = True
289 wrappedextraprepare = extensions.wrappedfunction(exchange, 290 wrappedextraprepare = extensions.wrappedfunction(exchange,
290 '_pullbundle2extraprepare', pullbundle2extraprepare_widen) 291 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
291 292
292 # define a function that narrowbundle2 can call after creating the 293 # define a function that narrowbundle2 can call after creating the
293 # backup bundle, but before applying the bundle from the server 294 # backup bundle, but before applying the bundle from the server