##// END OF EJS Templates
repositories: allow storing push url for automation.
marcink -
r2560:69c11742 default
parent child Browse files
Show More
@@ -0,0 +1,39 b''
1 import logging
2
3 from sqlalchemy import *
4
5 from rhodecode.model import meta
6 from rhodecode.lib.dbmigrate.versions import _reset_base, notify
7
8 log = logging.getLogger(__name__)
9
10
11 def upgrade(migrate_engine):
12 """
13 Upgrade operations go here.
14 Don't create your own engine; bind migrate_engine to your metadata
15 """
16 _reset_base(migrate_engine)
17 from rhodecode.lib.dbmigrate.schema import db_4_11_0_0 as db
18
19 repository_table = db.Repository.__table__
20
21 push_uri = Column(
22 "push_uri", db.EncryptedTextValue(), nullable=True, unique=False,
23 default=None)
24
25 push_uri.create(table=repository_table)
26
27 # issue fixups
28 fixups(db, meta.Session)
29
30
31 def downgrade(migrate_engine):
32 meta = MetaData()
33 meta.bind = migrate_engine
34
35
36 def fixups(models, _SESSION):
37 pass
38
39
@@ -51,7 +51,7 b' PYRAMID_SETTINGS = {}'
51 51 EXTENSIONS = {}
52 52
53 53 __version__ = ('.'.join((str(each) for each in VERSION[:3])))
54 __dbversion__ = 85 # defines current db version for migrations
54 __dbversion__ = 86 # defines current db version for migrations
55 55 __platform__ = platform.system()
56 56 __license__ = 'AGPLv3, and Commercial License'
57 57 __author__ = 'RhodeCode GmbH'
@@ -1557,6 +1557,9 b' class Repository(Base, BaseModel):'
1557 1557 clone_uri = Column(
1558 1558 "clone_uri", EncryptedTextValue(), nullable=True, unique=False,
1559 1559 default=None)
1560 push_uri = Column(
1561 "push_uri", EncryptedTextValue(), nullable=True, unique=False,
1562 default=None)
1560 1563 repo_type = Column(
1561 1564 "repo_type", String(255), nullable=False, unique=False, default=None)
1562 1565 user_id = Column(
@@ -1943,6 +1946,7 b' class Repository(Base, BaseModel):'
1943 1946 'repo_name': repo.repo_name,
1944 1947 'repo_type': repo.repo_type,
1945 1948 'clone_uri': repo.clone_uri or '',
1949 'push_uri': repo.push_uri or '',
1946 1950 'url': RepoModel().get_url(self),
1947 1951 'private': repo.private,
1948 1952 'created_on': repo.created_on,
@@ -2077,6 +2081,16 b' class Repository(Base, BaseModel):'
2077 2081 clone_uri = url_obj.with_password('*****')
2078 2082 return clone_uri
2079 2083
2084 @property
2085 def push_uri_hidden(self):
2086 push_uri = self.push_uri
2087 if push_uri:
2088 import urlobject
2089 url_obj = urlobject.URLObject(cleaned_uri(push_uri))
2090 if url_obj.password:
2091 push_uri = url_obj.with_password('*****')
2092 return push_uri
2093
2080 2094 def clone_url(self, **override):
2081 2095 from rhodecode.model.settings import SettingsModel
2082 2096
General Comments 0
You need to be logged in to leave comments. Login now