Mercurial > hg
comparison mercurial/exchange.py @ 26449:89b7a7883aee
exchange: move stream clone logic into pull code path
Stream clones are a special case of clones. Clones are a special case of
pull. Most of the logic for deciding what to do at pull time is in
exchange.py. It makes sense for the stream clone determination to live
there as well.
This patch moves the calling of the stream clone code into pull(). The
checks in streamclone.canperformstreamclone() ensure that we don't
perform a stream clone unless it is possible.
A future patch will convert maybeperformstreamclone() to accept a
pullop to make it consistent with everything else in pull(). It will
also grow some functionality (in case you doubted the necessity of a 4
line function).
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 02 Oct 2015 23:04:52 -0700 |
parents | e05fd574c922 |
children | 362793295640 |
comparison
equal
deleted
inserted
replaced
26448:e05fd574c922 | 26449:89b7a7883aee |
---|---|
9 from node import hex, nullid | 9 from node import hex, nullid |
10 import errno, urllib | 10 import errno, urllib |
11 import util, scmutil, changegroup, base85, error | 11 import util, scmutil, changegroup, base85, error |
12 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey | 12 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey |
13 import lock as lockmod | 13 import lock as lockmod |
14 import streamclone | |
14 import tags | 15 import tags |
15 | 16 |
16 def readbundle(ui, fh, fname, vfs=None): | 17 def readbundle(ui, fh, fname, vfs=None): |
17 header = changegroup.readexactly(fh, 4) | 18 header = changegroup.readexactly(fh, 4) |
18 | 19 |
961 raise util.Abort(msg) | 962 raise util.Abort(msg) |
962 | 963 |
963 lock = pullop.repo.lock() | 964 lock = pullop.repo.lock() |
964 try: | 965 try: |
965 pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) | 966 pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) |
967 streamclone.maybeperformstreamclone(pullop.repo, pullop.remote, | |
968 pullop.heads, | |
969 pullop.streamclonerequested) | |
966 _pulldiscovery(pullop) | 970 _pulldiscovery(pullop) |
967 if _canusebundle2(pullop): | 971 if _canusebundle2(pullop): |
968 _pullbundle2(pullop) | 972 _pullbundle2(pullop) |
969 _pullchangeset(pullop) | 973 _pullchangeset(pullop) |
970 _pullphase(pullop) | 974 _pullphase(pullop) |