866 pullop.releasetransaction() |
866 pullop.releasetransaction() |
867 lock.release() |
867 lock.release() |
868 |
868 |
869 return pullop |
869 return pullop |
870 |
870 |
|
871 # list of steps to perform discovery before pull |
|
872 pulldiscoveryorder = [] |
|
873 |
|
874 # Mapping between step name and function |
|
875 # |
|
876 # This exists to help extensions wrap steps if necessary |
|
877 pulldiscoverymapping = {} |
|
878 |
|
879 def pulldiscovery(stepname): |
|
880 """decorator for function performing discovery before pull |
|
881 |
|
882 The function is added to the step -> function mapping and appended to the |
|
883 list of steps. Beware that decorated function will be added in order (this |
|
884 may matter). |
|
885 |
|
886 You can only use this decorator for a new step, if you want to wrap a step |
|
887 from an extension, change the pulldiscovery dictionary directly.""" |
|
888 def dec(func): |
|
889 assert stepname not in pulldiscoverymapping |
|
890 pulldiscoverymapping[stepname] = func |
|
891 pulldiscoveryorder.append(stepname) |
|
892 return func |
|
893 return dec |
|
894 |
871 def _pulldiscovery(pullop): |
895 def _pulldiscovery(pullop): |
|
896 """Run all discovery steps""" |
|
897 for stepname in pulldiscoveryorder: |
|
898 step = pulldiscoverymapping[stepname] |
|
899 step(pullop) |
|
900 |
|
901 @pulldiscovery('changegroup') |
|
902 def _pulldiscoverychangegroup(pullop): |
872 """discovery phase for the pull |
903 """discovery phase for the pull |
873 |
904 |
874 Current handle changeset discovery only, will change handle all discovery |
905 Current handle changeset discovery only, will change handle all discovery |
875 at some point.""" |
906 at some point.""" |
876 tmp = discovery.findcommonincoming(pullop.repo.unfiltered(), |
907 tmp = discovery.findcommonincoming(pullop.repo.unfiltered(), |