Ejemplo n.º 1
0
 def add_changeset(self, rev, message, author, date, changes=()):
     if rev is None:
         rev = self.last_rev = self.last_rev + 1
     changeset = Changeset(self, str(rev), message, author, date)
     changeset.get_changes = lambda: changes
     self.changesets[changeset.rev] = changeset
     self.revisions.append(changeset.rev)
     return str(rev)
Ejemplo n.º 2
0
 def add_changeset(self, rev, message, author, date, changes=()):
     if rev is None:
         rev = self.last_rev = self.last_rev + 1
     changeset = Changeset(self, str(rev), message, author, date)
     changeset.get_changes = lambda: changes
     self.changesets[changeset.rev] = changeset
     self.revisions.append(changeset.rev)
     return str(rev)
Ejemplo n.º 3
0
 def __init__(self, rev, authz, scope, fs_ptr):
     self.rev = rev
     self.authz = authz
     self.scope = scope
     self.fs_ptr = fs_ptr
     message = self._get_prop(core.SVN_PROP_REVISION_LOG)
     author = self._get_prop(core.SVN_PROP_REVISION_AUTHOR)
     date = self._get_prop(core.SVN_PROP_REVISION_DATE)
     date = core.svn_time_from_cstring(date) // 1000000
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 4
0
 def __init__(self, rev, authz, scope, fs_ptr):
     self.rev = rev
     self.authz = authz
     self.scope = scope
     self.fs_ptr = fs_ptr
     message = self._get_prop(core.SVN_PROP_REVISION_LOG)
     author = self._get_prop(core.SVN_PROP_REVISION_AUTHOR)
     date = self._get_prop(core.SVN_PROP_REVISION_DATE)
     date = core.svn_time_from_cstring(date) / 1000000
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 5
0
    def __init__(self, change, repository, log, job_prefix_length):
        log.debug('PerforceChangeset(%r) created' % change)

        self._job_prefix_length = job_prefix_length
        self._change = int(change)
        self._repos = repository
        self._log = log
        self._changelist = self._repos.getChangelist(self._change)
        Changeset.__init__(self, self._change, self._changelist.description,
                           self._changelist.user, self._changelist.time)
Ejemplo n.º 6
0
    def __init__(self, change, repository, log, job_prefix_length):
        log.debug('PerforceChangeset(%r) created' % change)

        self._job_prefix_length = job_prefix_length
        self._change = int(change)
        self._repos = repository
        self._log = log
        self._changelist = self._repos.getChangelist(self._change)
        Changeset.__init__(self, self._change, self._changelist.description,
                           self._changelist.user, self._changelist.time)
Ejemplo n.º 7
0
    def __init__(self, git, sha):
        self.git = git
        try:
            (msg, props) = git.read_commit(sha)
        except PyGIT.GitErrorSha:
            raise NoSuchChangeset(sha)
        self.props = props

        committer = props['committer'][0]
        (user, time, tz) = committer.rsplit(None, 2)

        Changeset.__init__(self, sha, msg, user, float(time))
Ejemplo n.º 8
0
 def __init__(self, repos, rev, env):
     self.env = env
     for _date, author, message in self.env.db_query("""
             SELECT time, author, message FROM revision
             WHERE repos=%s AND rev=%s
             """, (repos.id, repos.db_rev(rev))):
         date = from_utimestamp(_date)
         Changeset.__init__(self, repos, repos.rev_db(rev), message, author,
                            date)
         break
     else:
         raise NoSuchChangeset(rev)
Ejemplo n.º 9
0
    def __init__(self, git, sha):
        self.git = git
        try:
            (msg, props) = git.read_commit(sha)
        except PyGIT.GitErrorSha:
            raise NoSuchChangeset(sha)
        self.props = props

        committer = props["committer"][0]
        (user, time, tz) = committer.rsplit(None, 2)

        Changeset.__init__(self, sha, msg, user, float(time))
Ejemplo n.º 10
0
 def __init__(self, repos, rev, env):
     self.env = env
     for _date, author, message in self.env.db_query("""
             SELECT time, author, message FROM revision
             WHERE repos=%s AND rev=%s
             """, (repos.id, repos.db_rev(rev))):
         date = from_utimestamp(_date)
         Changeset.__init__(self, repos, repos.rev_db(rev), message, author,
                            date)
         break
     else:
         raise NoSuchChangeset(rev)
Ejemplo n.º 11
0
 def __init__(self, rev, db, authz):
     self.db = db
     self.authz = authz
     cursor = self.db.cursor()
     cursor.execute("SELECT time,author,message FROM revision "
                    "WHERE rev=%s", (rev,))
     row = cursor.fetchone()
     if row:
         date, author, message = row
         Changeset.__init__(self, rev, message, author, int(date))
     else:
         raise NoSuchChangeset(rev)
Ejemplo n.º 12
0
 def __init__(self, rev, db, authz):
     self.db = db
     self.authz = authz
     cursor = self.db.cursor()
     cursor.execute("SELECT time,author,message FROM revision "
                    "WHERE rev=%s", (rev,))
     row = cursor.fetchone()
     if row:
         date, author, message = row
         Changeset.__init__(self, rev, message, author, int(date))
     else:
         raise TracError, "No changeset %s in the repository" % rev
Ejemplo n.º 13
0
 def __init__(self, rev, db, authz):
     self.db = db
     self.authz = authz
     cursor = self.db.cursor()
     cursor.execute(
         "SELECT time,author,message FROM revision "
         "WHERE rev=%s", (rev, ))
     row = cursor.fetchone()
     if row:
         date, author, message = row
         Changeset.__init__(self, rev, message, author, int(date))
     else:
         raise NoSuchChangeset(rev)
Ejemplo n.º 14
0
 def __init__(self, rev, authz, scope, fs_ptr, pool=None):
     self.rev = rev
     self.authz = authz
     self.scope = scope
     self.fs_ptr = fs_ptr
     self.pool = Pool(pool)
     message = self._get_prop(core.SVN_PROP_REVISION_LOG)
     author = self._get_prop(core.SVN_PROP_REVISION_AUTHOR)
     date = self._get_prop(core.SVN_PROP_REVISION_DATE)
     if date:
         date = core.svn_time_from_cstring(date, self.pool()) / 1000000
     else:
         date = 0
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 15
0
 def __init__(self, p4c, rev, change, log):
     self.log = log
     self.rev = rev
     self.change = change
     self.p4c = p4c
     message = ""
     author = ""
     date = 0
     #self.log.debug("*** changeset init = %s  rev = %s" % (change, rev))
     if len(change) != 0:
         message = self.change['desc']
         author = self.change['user']
         date = int(self.change['time'])
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 16
0
 def __init__(self, p4c, rev, change, log):
     self.log = log
     self.rev = rev
     self.change = change
     self.p4c = p4c
     message = ""
     author = ""
     date = 0
     #self.log.debug("*** changeset init = %s  rev = %s" % (change, rev))
     if len(change) != 0: 
         message = self.change['desc']	
         author = self.change['user']
         date = int(self.change['time'])
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 17
0
 def __init__(self, rev, authz, scope, fs_ptr, pool=None):
     self.rev = rev
     self.authz = authz
     self.scope = scope
     self.fs_ptr = fs_ptr
     self.pool = Pool(pool)
     message = self._get_prop(core.SVN_PROP_REVISION_LOG)
     author = self._get_prop(core.SVN_PROP_REVISION_AUTHOR)
     date = self._get_prop(core.SVN_PROP_REVISION_DATE)
     if date:
         date = core.svn_time_from_cstring(date, self.pool()) / 1000000
     else:
         date = 0
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 18
0
 def __init__(self, repos, rev, env):
     self.env = env
     db = self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.execute(
         "SELECT time,author,message FROM revision "
         "WHERE repos=%s AND rev=%s", (repos.id, repos.db_rev(rev)))
     row = cursor.fetchone()
     if row:
         _date, author, message = row
         date = from_utimestamp(_date)
         Changeset.__init__(self, repos, repos.rev_db(rev), message, author,
                            date)
     else:
         raise NoSuchChangeset(rev)
Ejemplo n.º 19
0
 def __init__(self, p4c, rev, change, log):
     # _deb = time.time()
     self.log = log
     self.rev = rev
     self.change = change
     self.p4c = p4c
     message = ""
     author = ""
     date = 0
     # self.log.debug("*** changeset init = %s  rev = %s" % (change, rev))
     if len(change) != 0:
         message = self.change["desc"]
         author = self.change["user"]
         date = int(self.change["time"])
     Changeset.__init__(self, rev, message, author, date)
Ejemplo n.º 20
0
 def __init__(self, repos, rev, env):
     self.env = env
     db = self.env.get_db_cnx()
     cursor = db.cursor()
     cursor.execute("SELECT time,author,message FROM revision "
                    "WHERE repos=%s AND rev=%s",
                    (repos.id, repos.db_rev(rev)))
     row = cursor.fetchone()
     if row:
         _date, author, message = row
         date = from_utimestamp(_date)
         Changeset.__init__(self, repos, repos.rev_db(rev), message, author,
                            date)
     else:
         raise NoSuchChangeset(rev)
Ejemplo n.º 21
0
 def __init__(self, repos, rev, env):
     self.env = env
     drev = repos.db_rev(rev)
     for _date, author, message in self.env.db_query(
             """
             SELECT time, author, message FROM revision
             WHERE repos=%s AND rev=%s
             """, (repos.id, drev)):
         date = from_utimestamp(_date)
         Changeset.__init__(self, repos, repos.rev_db(rev), message, author,
                            date)
         break
     else:
         repos.log.debug("Missing revision record (%r, %r) in '%s'",
                         repos.id, drev, _norm_reponame(repos))
         raise NoSuchChangeset(rev)
Ejemplo n.º 22
0
 def __init__(self, repos, rev, getdb, authz):
     self.repos = repos
     self.getdb = getdb
     self.authz = authz
     db = self.getdb()
     cursor = db.cursor()
     cursor.execute("SELECT time,author,message FROM revision "
                    "WHERE rev=%s", (str(rev),))
     row = cursor.fetchone()
     if row:
         _date, author, message = row
         date = datetime.fromtimestamp(_date, utc)
         Changeset.__init__(self, rev, message, author, date)
     else:
         raise NoSuchChangeset(rev)
     self.scope = getattr(repos, 'scope', '')
Ejemplo n.º 23
0
 def __init__(self, repos, n):
     log = repos.repo.changelog
     log_data = log.read(n)
     manifest, user, timeinfo, files, desc = log_data[:5]
     extra = {}
     if len(log_data) > 5:  # extended changelog, since [hg 2f35961854fb]
         extra = log_data[5]
     time = repos.hg_time(timeinfo)
     Changeset.__init__(self, repos.hg_display(n), to_unicode(desc), user,
                        time)
     self.repos = repos
     self.n = n
     self.manifest_n = manifest
     self.files = files
     self.parents = [repos.hg_display(p) for p in log.parents(n) \
                     if p != nullid]
     self.children = [repos.hg_display(c) for c in log.children(n)]
     self.tags = [t for t in repos.repo.nodetags(n)]
     self.extra = extra
Ejemplo n.º 24
0
Archivo: svn_fs.py Proyecto: t2y/trac
 def __init__(self, repos, rev, scope, pool=None):
     self.rev = rev
     self.scope = scope
     self.fs_ptr = repos.fs_ptr
     self.pool = Pool(pool)
     try:
         message = self._get_prop(core.SVN_PROP_REVISION_LOG)
     except core.SubversionException:
         raise NoSuchChangeset(rev)
     author = self._get_prop(core.SVN_PROP_REVISION_AUTHOR)
     # we _hope_ it's UTF-8, but can't be 100% sure (#4321)
     message = message and to_unicode(message, 'utf-8')
     author = author and to_unicode(author, 'utf-8')
     _date = self._get_prop(core.SVN_PROP_REVISION_DATE)
     if _date:
         ts = core.svn_time_from_cstring(_date, self.pool())
         date = from_utimestamp(ts)
     else:
         date = None
     Changeset.__init__(self, repos, rev, message, author, date)
Ejemplo n.º 25
0
 def __init__(self, repos, rev, scope, pool=None):
     self.rev = rev
     self.scope = scope
     self.fs_ptr = repos.fs_ptr
     self.pool = Pool(pool)
     try:
         message = self._get_prop(core.SVN_PROP_REVISION_LOG)
     except core.SubversionException:
         raise NoSuchChangeset(rev)
     author = self._get_prop(core.SVN_PROP_REVISION_AUTHOR)
     # we _hope_ it's UTF-8, but can't be 100% sure (#4321)
     message = message and to_unicode(message, 'utf-8')
     author = author and to_unicode(author, 'utf-8')
     _date = self._get_prop(core.SVN_PROP_REVISION_DATE)
     if _date:
         ts = core.svn_time_from_cstring(_date, self.pool())
         date = from_utimestamp(ts)
     else:
         date = None
     Changeset.__init__(self, repos, rev, message, author, date)
Ejemplo n.º 26
0
 def do_sync(db):
     cursor = db.cursor()
     cursor.execute(
         """
         SELECT time,author,message FROM revision
         WHERE repos=%s AND rev=%s
         """, (self.id, srev))
     for time, author, message in cursor:
         old_cset[0] = Changeset(self.repos, cset.rev, message, author,
                                 from_utimestamp(time))
     cursor.execute(
         """
         UPDATE revision SET time=%s, author=%s, message=%s
         WHERE repos=%s AND rev=%s
         """, (to_utimestamp(
             cset.date), cset.author, cset.message, self.id, srev))
Ejemplo n.º 27
0
    def sync_changeset(self, rev):
        cset = self.repos.get_changeset(rev)
        srev = self.db_rev(cset.rev)
        old_cset = None

        with self.env.db_transaction as db:
            for time, author, message in db(
                    """
                    SELECT time, author, message FROM revision
                    WHERE repos=%s AND rev=%s
                    """, (self.id, srev)):
                old_cset = Changeset(self.repos, cset.rev, message, author,
                                     from_utimestamp(time))
            if old_cset:
                db(
                    """UPDATE revision SET time=%s, author=%s, message=%s
                      WHERE repos=%s AND rev=%s
                      """, (to_utimestamp(
                        cset.date), cset.author, cset.message, self.id, srev))
            else:
                self._insert_changeset(db, rev, cset)
        return old_cset