Show More
@@ -3064,8 +3064,7 b' class _PullRequestBase(BaseModel):' | |||
|
3064 | 3064 | |
|
3065 | 3065 | @property |
|
3066 | 3066 | def source_ref_parts(self): |
|
3067 | refs = self.source_ref.split(':') | |
|
3068 | return Reference(refs[0], refs[1], refs[2]) | |
|
3067 | return self.unicode_to_reference(self.source_ref) | |
|
3069 | 3068 | |
|
3070 | 3069 | @declared_attr |
|
3071 | 3070 | def target_repo(cls): |
@@ -3075,8 +3074,28 b' class _PullRequestBase(BaseModel):' | |||
|
3075 | 3074 | |
|
3076 | 3075 | @property |
|
3077 | 3076 | def target_ref_parts(self): |
|
3078 | refs = self.target_ref.split(':') | |
|
3079 | return Reference(refs[0], refs[1], refs[2]) | |
|
3077 | return self.unicode_to_reference(self.target_ref) | |
|
3078 | ||
|
3079 | def unicode_to_reference(self, raw): | |
|
3080 | """ | |
|
3081 | Convert a unicode (or string) to a reference object. | |
|
3082 | If unicode evaluates to False it returns None. | |
|
3083 | """ | |
|
3084 | if raw: | |
|
3085 | refs = raw.split(':') | |
|
3086 | return Reference(*refs) | |
|
3087 | else: | |
|
3088 | return None | |
|
3089 | ||
|
3090 | def reference_to_unicode(self, ref): | |
|
3091 | """ | |
|
3092 | Convert a reference object to unicode. | |
|
3093 | If reference is None it returns None. | |
|
3094 | """ | |
|
3095 | if ref: | |
|
3096 | return u':'.join(ref) | |
|
3097 | else: | |
|
3098 | return None | |
|
3080 | 3099 | |
|
3081 | 3100 | |
|
3082 | 3101 | class PullRequest(Base, _PullRequestBase): |
General Comments 0
You need to be logged in to leave comments.
Login now