##// END OF EJS Templates
path: add a method to retrieve a "push variant" of a path...
marmoute -
r50591:0acefbbc default
parent child Browse files
Show More
@@ -867,6 +867,7 b' class path:'
867 self.name = name
867 self.name = name
868
868
869 # set by path variant to point to their "non-push" version
869 # set by path variant to point to their "non-push" version
870 self.main_path = None
870 self._setup_url(rawloc)
871 self._setup_url(rawloc)
871
872
872 if validate_path:
873 if validate_path:
@@ -907,6 +908,26 b' class path:'
907 new.__dict__[k] = v
908 new.__dict__[k] = v
908 return new
909 return new
909
910
911 @property
912 def is_push_variant(self):
913 """is this a path variant to be used for pushing"""
914 return self.main_path is not None
915
916 def get_push_variant(self):
917 """get a "copy" of the path, but suitable for pushing
918
919 This means using the value of the `pushurl` option (if any) as the url.
920
921 The original path is available in the `main_path` attribute.
922 """
923 if self.main_path:
924 return self
925 new = self.copy()
926 new.main_path = self
927 if self.pushloc:
928 new._setup_url(self.pushloc)
929 return new
930
910 def _validate_path(self):
931 def _validate_path(self):
911 # When given a raw location but not a symbolic name, validate the
932 # When given a raw location but not a symbolic name, validate the
912 # location is valid.
933 # location is valid.
General Comments 0
You need to be logged in to leave comments. Login now