Show More
@@ -3577,7 +3577,33 b' class _PullRequestBase(BaseModel):' | |||||
3577 | 'org_repo_id', Integer(), ForeignKey('repositories.repo_id'), |
|
3577 | 'org_repo_id', Integer(), ForeignKey('repositories.repo_id'), | |
3578 | nullable=False) |
|
3578 | nullable=False) | |
3579 |
|
3579 | |||
3580 | source_ref = Column('org_ref', Unicode(255), nullable=False) |
|
3580 | _source_ref = Column('org_ref', Unicode(255), nullable=False) | |
|
3581 | ||||
|
3582 | @hybrid_property | |||
|
3583 | def source_ref(self): | |||
|
3584 | return self._source_ref | |||
|
3585 | ||||
|
3586 | @source_ref.setter | |||
|
3587 | def source_ref(self, val): | |||
|
3588 | parts = (val or '').split(':') | |||
|
3589 | if len(parts) != 3: | |||
|
3590 | raise ValueError( | |||
|
3591 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) | |||
|
3592 | self._source_ref = safe_unicode(val) | |||
|
3593 | ||||
|
3594 | _target_ref = Column('other_ref', Unicode(255), nullable=False) | |||
|
3595 | ||||
|
3596 | @hybrid_property | |||
|
3597 | def target_ref(self): | |||
|
3598 | return self._target_ref | |||
|
3599 | ||||
|
3600 | @target_ref.setter | |||
|
3601 | def target_ref(self, val): | |||
|
3602 | parts = (val or '').split(':') | |||
|
3603 | if len(parts) != 3: | |||
|
3604 | raise ValueError( | |||
|
3605 | 'Invalid reference format given: {}, expected X:Y:Z'.format(val)) | |||
|
3606 | self._target_ref = safe_unicode(val) | |||
3581 |
|
3607 | |||
3582 | @declared_attr |
|
3608 | @declared_attr | |
3583 | def target_repo_id(cls): |
|
3609 | def target_repo_id(cls): | |
@@ -3586,7 +3612,6 b' class _PullRequestBase(BaseModel):' | |||||
3586 | 'other_repo_id', Integer(), ForeignKey('repositories.repo_id'), |
|
3612 | 'other_repo_id', Integer(), ForeignKey('repositories.repo_id'), | |
3587 | nullable=False) |
|
3613 | nullable=False) | |
3588 |
|
3614 | |||
3589 | target_ref = Column('other_ref', Unicode(255), nullable=False) |
|
|||
3590 | _shadow_merge_ref = Column('shadow_merge_ref', Unicode(255), nullable=True) |
|
3615 | _shadow_merge_ref = Column('shadow_merge_ref', Unicode(255), nullable=True) | |
3591 |
|
3616 | |||
3592 | # TODO: dan: rename column to last_merge_source_rev |
|
3617 | # TODO: dan: rename column to last_merge_source_rev | |
@@ -3659,7 +3684,8 b' class _PullRequestBase(BaseModel):' | |||||
3659 | def shadow_merge_ref(self, ref): |
|
3684 | def shadow_merge_ref(self, ref): | |
3660 | self._shadow_merge_ref = self.reference_to_unicode(ref) |
|
3685 | self._shadow_merge_ref = self.reference_to_unicode(ref) | |
3661 |
|
3686 | |||
3662 | def unicode_to_reference(self, raw): |
|
3687 | @staticmethod | |
|
3688 | def unicode_to_reference(raw): | |||
3663 | """ |
|
3689 | """ | |
3664 | Convert a unicode (or string) to a reference object. |
|
3690 | Convert a unicode (or string) to a reference object. | |
3665 | If unicode evaluates to False it returns None. |
|
3691 | If unicode evaluates to False it returns None. | |
@@ -3670,7 +3696,8 b' class _PullRequestBase(BaseModel):' | |||||
3670 | else: |
|
3696 | else: | |
3671 | return None |
|
3697 | return None | |
3672 |
|
3698 | |||
3673 | def reference_to_unicode(self, ref): |
|
3699 | @staticmethod | |
|
3700 | def reference_to_unicode(ref): | |||
3674 | """ |
|
3701 | """ | |
3675 | Convert a reference object to unicode. |
|
3702 | Convert a reference object to unicode. | |
3676 | If reference is None it returns None. |
|
3703 | If reference is None it returns None. |
General Comments 0
You need to be logged in to leave comments.
Login now