##// END OF EJS Templates
pull: make discovery phase extensible...
Pierre-Yves David -
r22936:dae23690 default
parent child Browse files
Show More
@@ -868,7 +868,38 b' def pull(repo, remote, heads=None, force'
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
General Comments 0
You need to be logged in to leave comments. Login now