rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1])
|
num, cnx = self._active.get(tid) if num == 0: cnx.rollback() self._active[tid][0] = num + 1 return PooledConnection(self, cnx, tid)
|
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection is stale break except Exception: cnx.close() elif self._maxsize and self._cursize < self._maxsize: cnx = self._connector.get_connection(**self._kwargs) self._cursize += 1 break else: if timeout: self._available.wait(timeout) if (time.time() - start) >= timeout: raise TimeoutError, 'Unable to get database ' \ 'connection within %d seconds' \ % timeout else: self._available.wait() self._active[tid] = [1, cnx] return PooledConnection(self, cnx) finally: self._available.release()
|
a1de96bebff9770eb40f149669bc57a62267c8d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a1de96bebff9770eb40f149669bc57a62267c8d8/pool.py
|
return PooledConnection(self, cnx)
|
return PooledConnection(self, cnx, tid)
|
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection is stale break except Exception: cnx.close() elif self._maxsize and self._cursize < self._maxsize: cnx = self._connector.get_connection(**self._kwargs) self._cursize += 1 break else: if timeout: self._available.wait(timeout) if (time.time() - start) >= timeout: raise TimeoutError, 'Unable to get database ' \ 'connection within %d seconds' \ % timeout else: self._available.wait() self._active[tid] = [1, cnx] return PooledConnection(self, cnx) finally: self._available.release()
|
a1de96bebff9770eb40f149669bc57a62267c8d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a1de96bebff9770eb40f149669bc57a62267c8d8/pool.py
|
def _return_cnx(self, cnx):
|
def _return_cnx(self, cnx, tid):
|
def _return_cnx(self, cnx): self._available.acquire() try: tid = threading._get_ident() if tid in self._active: num, cnx_ = self._active.get(tid) assert cnx is cnx_ if num > 1: self._active[tid][0] = num - 1 else: self._cleanup(tid) finally: self._available.release()
|
a1de96bebff9770eb40f149669bc57a62267c8d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a1de96bebff9770eb40f149669bc57a62267c8d8/pool.py
|
tid = threading._get_ident()
|
def _return_cnx(self, cnx): self._available.acquire() try: tid = threading._get_ident() if tid in self._active: num, cnx_ = self._active.get(tid) assert cnx is cnx_ if num > 1: self._active[tid][0] = num - 1 else: self._cleanup(tid) finally: self._available.release()
|
a1de96bebff9770eb40f149669bc57a62267c8d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a1de96bebff9770eb40f149669bc57a62267c8d8/pool.py
|
|
if cnx not in self._dormant: cnx.rollback() if cnx.poolable:
|
if cnx not in self._dormant: if cnx.poolable: cnx.rollback()
|
def _cleanup(self, tid): # Note: self._available *must* be acquired if tid in self._active: cnx = self._active.pop(tid)[1] if cnx not in self._dormant: cnx.rollback() if cnx.poolable: self._dormant.append(cnx) else: cnx.close() self._cursize -= 1 self._available.notify()
|
a1de96bebff9770eb40f149669bc57a62267c8d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a1de96bebff9770eb40f149669bc57a62267c8d8/pool.py
|
else:
|
elif tid == threading._get_ident(): cnx.rollback()
|
def _cleanup(self, tid): # Note: self._available *must* be acquired if tid in self._active: cnx = self._active.pop(tid)[1] if cnx not in self._dormant: cnx.rollback() if cnx.poolable: self._dormant.append(cnx) else: cnx.close() self._cursize -= 1 self._available.notify()
|
a1de96bebff9770eb40f149669bc57a62267c8d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a1de96bebff9770eb40f149669bc57a62267c8d8/pool.py
|
html = processor.process(req.hdf, text)
|
html = processor.process(req, text)
|
def code_formatter(language, text): processor = WikiProcessor(self.env, language) html = processor.process(req.hdf, text) raw = nodes.raw('', html, format='html') return raw
|
5a6aa676d494cb0c28e3fbab5e182a41e31c5353 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5a6aa676d494cb0c28e3fbab5e182a41e31c5353/rst.py
|
print>>sys.stderr, '[%d] wait for connection...' % tid
|
def get_cnx(self, timeout=None): start = time.time() self._available.acquire() try: tid = threading._get_ident() if tid in self._active: self._active[tid][0] += 1 return PooledConnection(self, self._active[tid][1]) while True: if self._dormant: cnx = self._dormant.pop() try: cnx.cursor() # check whether the connection is stale break except Exception: cnx.close() elif self._maxsize and self._cursize < self._maxsize: cnx = self._connector.get_connection(**self._kwargs) self._cursize += 1 break else: if timeout: self._available.wait(timeout) if (time.time() - start) >= timeout: raise TimeoutError, 'Unable to get database ' \ 'connection within %d seconds' \ % timeout else: print>>sys.stderr, '[%d] wait for connection...' % tid self._available.wait() self._active[tid] = [1, cnx] return PooledConnection(self, cnx) finally: self._available.release()
|
fcc87057cabf108934aa92baaefa782ddd74d016 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fcc87057cabf108934aa92baaefa782ddd74d016/pool.py
|
|
rev = None
|
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.unquote(label) path = urllib.unquote(path) if rev: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path, rev=rev), label) else: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path), label)
|
696cce90e24090a4fe381c8bcb390e48a33d7403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/696cce90e24090a4fe381c8bcb390e48a33d7403/Browser.py
|
|
match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2)
|
path, rev = _get_path_rev(path)
|
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.unquote(label) path = urllib.unquote(path) if rev: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path, rev=rev), label) else: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path), label)
|
696cce90e24090a4fe381c8bcb390e48a33d7403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/696cce90e24090a4fe381c8bcb390e48a33d7403/Browser.py
|
path = urllib.unquote(path) if rev: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path, rev=rev), label) else: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path), label)
|
return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path, rev=rev), label)
|
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.unquote(label) path = urllib.unquote(path) if rev: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path, rev=rev), label) else: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path), label)
|
696cce90e24090a4fe381c8bcb390e48a33d7403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/696cce90e24090a4fe381c8bcb390e48a33d7403/Browser.py
|
implements(INavigationContributor, IPermissionRequestor, IRequestHandler)
|
implements(INavigationContributor, IPermissionRequestor, IRequestHandler, IWikiSyntaxProvider)
|
def _format_link(self, formatter, ns, path, label): rev = None match = img_re.search(path) if formatter.flavor != 'oneliner' and match: return '<img src="%s" alt="%s" />' % \ (formatter.href.file(path, format='raw'), label) match = rev_re.search(path) if match: path = match.group(1) rev = match.group(2) label = urllib.unquote(label) path = urllib.unquote(path) if rev: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path, rev=rev), label) else: return '<a class="source" href="%s">%s</a>' \ % (formatter.href.browser(path), label)
|
696cce90e24090a4fe381c8bcb390e48a33d7403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/696cce90e24090a4fe381c8bcb390e48a33d7403/Browser.py
|
params = {'rev': rev, 'mode': mode, 'limit': limit}
|
link_rev = rev if rev == str(repos.youngest_rev): link_rev = None params = {'rev': link_rev, 'mode': mode, 'limit': limit}
|
def make_log_href(path, **args): params = {'rev': rev, 'mode': mode, 'limit': limit} params.update(args) if verbose: params['verbose'] = verbose return self.env.href.log(path, **params)
|
696cce90e24090a4fe381c8bcb390e48a33d7403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/696cce90e24090a4fe381c8bcb390e48a33d7403/Browser.py
|
cs['shortlog'] = util.escape(cs['shortlog'])
|
cs['shortlog'] = util.escape(cs['shortlog'].replace('\n', ' '))
|
def make_log_href(path, **args): params = {'rev': rev, 'mode': mode, 'limit': limit} params.update(args) if verbose: params['verbose'] = verbose return self.env.href.log(path, **params)
|
696cce90e24090a4fe381c8bcb390e48a33d7403 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/696cce90e24090a4fe381c8bcb390e48a33d7403/Browser.py
|
return cls.__module__.find('.tests.') == -1
|
return cls.__module__.startswith('trac.') and \ cls.__module__.find('.tests.') == -1
|
def is_component_enabled(self, cls): return cls.__module__.find('.tests.') == -1
|
59f0b58f73332ab7c1cf2b2e947b53711e7419d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/59f0b58f73332ab7c1cf2b2e947b53711e7419d1/admin.py
|
perm_map = {'tickets': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW,
|
perm_map = {'ticket': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW,
|
def get_info(self, req, start, stop, maxrows, filters=AVAILABLE_FILTERS): perm_map = {'tickets': perm.TICKET_VIEW, 'changeset': perm.CHANGESET_VIEW, 'wiki': perm.WIKI_VIEW, 'milestone': perm.MILESTONE_VIEW} filters = list(filters) # copy list so we can make modifications for k,v in perm_map.items(): if k in filters and not self.perm.has_permission(v): filters.remove(k) if not filters: return []
|
03b915cf214b20b96ca84d50965043312c0fbdd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/03b915cf214b20b96ca84d50965043312c0fbdd7/Timeline.py
|
"""Return the types of version control systems that are supported by this connector, and their relative priorities. Highest number is highest priority.
|
"""Return the types of version control systems that are supported. Yields `(repotype, priority)` pairs, where `repotype` is used to match against the configured `[trac] repository_type` value in TracIni. If multiple provider match a given type, the `priority` is used to choose between them (highest number is highest priority).
|
def get_supported_types(): """Return the types of version control systems that are supported by this connector, and their relative priorities. Highest number is highest priority. """
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
"""Return the Repository object for the given repository type and directory.
|
"""Return a Repository instance for the given repository type and dir.
|
def get_repository(repos_type, repos_dir, authname): """Return the Repository object for the given repository type and directory. """
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
"""Component that keeps track of the supported version control systems, and provides easy access to the configured implementation."""
|
"""Component registering the supported version control systems, It provides easy access to the configured implementation. """
|
def get_repository(repos_type, repos_dir, authname): """Return the Repository object for the given repository type and directory. """
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
raise TracError, 'Unsupported version control system "%s"' \ % self.repository_type
|
raise TracError('Unsupported version control system "%s"' % self.repository_type)
|
def get_repository(self, authname): if not self._connector: candidates = [] for connector in self.connectors: for repos_type_, prio in connector.get_supported_types(): if self.repository_type != repos_type_: continue heappush(candidates, (-prio, connector)) if not candidates: raise TracError, 'Unsupported version control system "%s"' \ % self.repository_type self._connector = heappop(candidates)[1] return self._connector.get_repository(self.repository_type, self.repository_dir, authname)
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Base class for a repository provided by a version control system. """
|
"""Base class for a repository provided by a version control system."""
|
def __init__(self, path, rev, msg=None): TracError.__init__(self, "%sNo node %s at revision %s" \ % (msg and '%s: ' % msg or '', path, rev))
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Close the connection to the repository. """
|
"""Close the connection to the repository."""
|
def close(self): """ Close the connection to the repository. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Retrieve a Changeset object that describes the changes made in revision 'rev'. """
|
"""Retrieve a Changeset corresponding to the given revision `rev`."""
|
def get_changeset(self, rev): """ Retrieve a Changeset object that describes the changes made in revision 'rev'. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Generate Changeset belonging to the given time period (start, stop).
|
"""Generate Changeset belonging to the given time period (start, stop).
|
def get_changesets(self, start, stop): """ Generate Changeset belonging to the given time period (start, stop). """ rev = self.youngest_rev while rev: if self.authz.has_permission_for_changeset(rev): chgset = self.get_changeset(rev) if chgset.date < start: return if chgset.date < stop: yield chgset rev = self.previous_rev(rev)
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Tell if there's a node at the specified (path,rev) combination.
|
"""Tell if there's a node at the specified (path,rev) combination.
|
def has_node(self, path, rev=None): """ Tell if there's a node at the specified (path,rev) combination.
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Retrieve a Node (directory or file) from the repository at the given path. If the rev parameter is specified, the version of the node at that revision is returned, otherwise the latest version of the node is returned.
|
"""Retrieve a Node from the repository at the given path. A Node represents a directory or a file at a given revision in the repository. If the `rev` parameter is specified, the Node corresponding to that revision is returned, otherwise the Node corresponding to the youngest revision is returned.
|
def get_node(self, path, rev=None): """ Retrieve a Node (directory or file) from the repository at the given path. If the rev parameter is specified, the version of the node at that revision is returned, otherwise the latest version of the node is returned. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return the oldest revision stored in the repository. """
|
"""Return the oldest revision stored in the repository."""
|
def get_oldest_rev(self): """ Return the oldest revision stored in the repository. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return the youngest revision in the repository. """
|
"""Return the youngest revision in the repository."""
|
def get_youngest_rev(self): """ Return the youngest revision in the repository. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return the revision immediately preceding the specified revision. """
|
"""Return the revision immediately preceding the specified revision."""
|
def previous_rev(self, rev): """ Return the revision immediately preceding the specified revision. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return the revision immediately following the specified revision. """
|
"""Return the revision immediately following the specified revision."""
|
def next_rev(self, rev, path=''): """ Return the revision immediately following the specified revision. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return True if rev1 is older than rev2, i.e. if rev1 comes before rev2 in the revision sequence.
|
"""Provides a total order over revisions. Return `True` if `rev1` is older than `rev2`, i.e. if `rev1` comes before `rev2` in the revision sequence.
|
def rev_older_than(self, rev1, rev2): """ Return True if rev1 is older than rev2, i.e. if rev1 comes before rev2 in the revision sequence. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return the youngest revision currently cached.
|
"""Return the youngest revision currently cached.
|
def get_youngest_rev_in_cache(self, db): """ Return the youngest revision currently cached. The way revisions are sequenced is version control specific. By default, one assumes that the revisions are sequenced in time. """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY time DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
By default, one assumes that the revisions are sequenced in time.
|
By default, one assumes that the revisions are sequenced in time (... which is ''not'' correct for most VCS, including Subversion).
|
def get_youngest_rev_in_cache(self, db): """ Return the youngest revision currently cached. The way revisions are sequenced is version control specific. By default, one assumes that the revisions are sequenced in time. """ cursor = db.cursor() cursor.execute("SELECT rev FROM revision ORDER BY time DESC LIMIT 1") row = cursor.fetchone() return row and row[0] or None
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Retrieve all the revisions containing this path (no newer than 'rev').
|
"""Retrieve all the revisions containing this path If given, `rev` is used as a starting point (i.e. no revision ''newer'' than `rev` should be returned).
|
def get_path_history(self, path, rev=None, limit=None): """ Retrieve all the revisions containing this path (no newer than 'rev'). The result format should be the same as the one of Node.get_history() """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return a canonical representation of path in the repos. """
|
"""Return a canonical representation of path in the repos."""
|
def normalize_path(self, path): """ Return a canonical representation of path in the repos. """ return NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return a canonical representation of a revision in the repos. 'None' is a valid revision value and represents the youngest revision.
|
"""Return a canonical representation of a revision. It's up to the backend to decide which string values of `rev` (usually provided by the user) should be accepted, and how they should be normalized. Some backends may for instance want to match against known tags or branch names. In addition, if `rev` is `None` or '', the youngest revision should be returned.
|
def normalize_rev(self, rev): """ Return a canonical representation of a revision in the repos. 'None' is a valid revision value and represents the youngest revision. """ return NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return a compact representation of a revision in the repos. """
|
"""Return a compact representation of a revision in the repos."""
|
def short_rev(self, rev): """ Return a compact representation of a revision in the repos. """ return self.normalize_rev(rev)
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
"""
|
"""Generates changes corresponding to generalized diffs.
|
def get_changes(self, old_path, old_rev, new_path, new_rev, ignore_ancestry=1): """ Generator that yields change tuples (old_node, new_node, kind, change) for each node change between the two arbitrary (path,rev) pairs.
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Represents a directory or file in the repository. """
|
"""Represents a directory or file in the repository at a given revision."""
|
def get_changes(self, old_path, old_rev, new_path, new_rev, ignore_ancestry=1): """ Generator that yields change tuples (old_node, new_node, kind, change) for each node change between the two arbitrary (path,rev) pairs.
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
assert kind in (Node.DIRECTORY, Node.FILE), "Unknown node kind %s" % kind
|
assert kind in (Node.DIRECTORY, Node.FILE), \ "Unknown node kind %s" % kind
|
def __init__(self, path, rev, kind): assert kind in (Node.DIRECTORY, Node.FILE), "Unknown node kind %s" % kind self.path = unicode(path) self.rev = rev self.kind = kind
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return a stream for reading the content of the node. This method will return None for directories. The returned object should provide a read([len]) function.
|
"""Return a stream for reading the content of the node. This method will return `None` for directories. The returned object must support a `read([len])` method.
|
def get_content(self): """ Return a stream for reading the content of the node. This method will return None for directories. The returned object should provide a read([len]) function. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Generator that yields the immediate child entries of a directory, in no particular order. If the node is a file, this method returns None.
|
"""Generator that yields the immediate child entries of a directory. The entries are returned in no particular order. If the node is a file, this method returns `None`.
|
def get_entries(self): """ Generator that yields the immediate child entries of a directory, in no particular order. If the node is a file, this method returns None. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Generator that yields (path, rev, chg) tuples, one for each revision in which the node was changed. This generator will follow copies and moves of a node (if the underlying version control system supports that), which will be indicated by the first element of the tuple (i.e. the path) changing.
|
"""Provide backward history for this Node. Generator that yields `(path, rev, chg)` tuples, one for each revision in which the node was changed. This generator will follow copies and moves of a node (if the underlying version control system supports that), which will be indicated by the first element of the tuple (i.e. the path) changing.
|
def get_history(self, limit=None): """ Generator that yields (path, rev, chg) tuples, one for each revision in which the node was changed. This generator will follow copies and moves of a node (if the underlying version control system supports that), which will be indicated by the first element of the tuple (i.e. the path) changing. Starts with an entry for the current revision. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Return the (path, rev, chg) tuple corresponding to the previous revision for that node.
|
"""Return the change event corresponding to the previous revision. This returns a `(path, rev, chg)` tuple.
|
def get_previous(self): """ Return the (path, rev, chg) tuple corresponding to the previous revision for that node. """ skip = True for p in self.get_history(2): if skip: skip = False else: return p
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Returns a dictionary containing the properties (meta-data) of the node.
|
"""Returns the properties (meta-data) of the node, as a dictionary.
|
def get_properties(self): """ Returns a dictionary containing the properties (meta-data) of the node. The set of properties depends on the version control system. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Represents a set of changes of a repository. """
|
"""Represents a set of changes committed at once in a repository."""
|
def get_last_modified(self): raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Generator that produces a (path, kind, change, base_path, base_rev) tuple for every change in the changeset, where change can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY.
|
"""Generator that produces a tuple for every change in the changeset The tuple will contain `(path, kind, change, base_path, base_rev)`, where `change` can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and `kind` is one of Node.FILE or Node.DIRECTORY.
|
def get_changes(self): """ Generator that produces a (path, kind, change, base_path, base_rev) tuple for every change in the changeset, where change can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
""" Exception raised by an authorizer if the user has insufficient permissions
|
"""Exception raised by an authorizer. This exception is raise if the user has insufficient permissions
|
def get_changes(self): """ Generator that produces a (path, kind, change, base_path, base_rev) tuple for every change in the changeset, where change can be one of Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. """ raise NotImplementedError
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
"""
|
"""Controls the view access to parts of the repository.
|
def __str__(self): return self.action
|
0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0091f73d9ddb2e28de9da1a025ba0c0cfaf2b458/api.py
|
def authz_cb(root, path, pool): return self.authzperm.has_permission(path) and 1 or 0 svn.repos.svn_repos_get_logs(self.repos, [path], 0, rev, 1, authz_cb, self.log_receiver, self.pool)
|
try: def authz_cb(root, path, pool): return self.authzperm.has_permission(path) and 1 or 0 svn.repos.svn_repos_get_logs2(self.repos, [path], 0, rev, 1, 0, authz_cb, self.log_receiver, self.pool) except AttributeError: svn.repos.svn_repos_get_logs(self.repos, [path], 0, rev, 1, 0, self.log_receiver, self.pool)
|
def authz_cb(root, path, pool): return self.authzperm.has_permission(path) and 1 or 0
|
70421448f2f73b8805b809d1c923e72013b2c5bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/70421448f2f73b8805b809d1c923e72013b2c5bc/Log.py
|
self._render_rss(req, db)
|
self._render_rss(req)
|
def render_report_list(self, req, db, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ actions = {'create': perm.REPORT_CREATE, 'delete': perm.REPORT_DELETE, 'modify': perm.REPORT_MODIFY} for action in [k for k,v in actions.items() if req.perm.has_permission(v)]: req.hdf['report.can_' + action] = True req.hdf['report.href'] = self.env.href.report(id) if id != -1: req.hdf['report.overview_href'] = self.env.href.report()
|
aed112d4a2c613a3b88dc2f6fcd548cb5dfe8af9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/aed112d4a2c613a3b88dc2f6fcd548cb5dfe8af9/Report.py
|
return None
|
def render_report_list(self, req, db, id): """ uses a user specified sql query to extract some information from the database and presents it as a html table. """ actions = {'create': perm.REPORT_CREATE, 'delete': perm.REPORT_DELETE, 'modify': perm.REPORT_MODIFY} for action in [k for k,v in actions.items() if req.perm.has_permission(v)]: req.hdf['report.can_' + action] = True req.hdf['report.href'] = self.env.href.report(id) if id != -1: req.hdf['report.overview_href'] = self.env.href.report()
|
aed112d4a2c613a3b88dc2f6fcd548cb5dfe8af9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/aed112d4a2c613a3b88dc2f6fcd548cb5dfe8af9/Report.py
|
|
name, val = columns[i], row[i]
|
name, field, val = columns[i], fields[i], row[i]
|
def execute(self, req, db=None): if not self.cols: self.get_columns()
|
bf402227a11efd5da203fbd61cb071b13d15be9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/bf402227a11efd5da203fbd61cb071b13d15be9a/query.py
|
elif val is None: val = '--'
|
elif field and field['type'] == 'checkbox': try: val = bool(int(val)) except TypeError, ValueError: val = False
|
def execute(self, req, db=None): if not self.cols: self.get_columns()
|
bf402227a11efd5da203fbd61cb071b13d15be9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/bf402227a11efd5da203fbd61cb071b13d15be9a/query.py
|
chgset.message,
|
message,
|
def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters:
|
acd9e25573f65bec86a5d3b8264eb729b139ba36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/acd9e25573f65bec86a5d3b8264eb729b139ba36/changeset.py
|
pass
|
message = None
|
def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters:
|
acd9e25573f65bec86a5d3b8264eb729b139ba36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/acd9e25573f65bec86a5d3b8264eb729b139ba36/changeset.py
|
self._render_html(req, repos, chgset, restricted,
|
self._render_html(req, repos, chgset, restricted, message,
|
def process_request(self, req): """The appropriate mode of operation is inferred from the request parameters:
|
acd9e25573f65bec86a5d3b8264eb729b139ba36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/acd9e25573f65bec86a5d3b8264eb729b139ba36/changeset.py
|
def _render_html(self, req, repos, chgset, restricted, diff, diff_options):
|
def _render_html(self, req, repos, chgset, restricted, message, diff, diff_options):
|
def _render_html(self, req, repos, chgset, restricted, diff, diff_options): """HTML version""" req.hdf['changeset'] = { 'chgset': chgset and True, 'restricted': restricted, 'href': { 'new_rev': req.href.changeset(diff.new_rev), 'old_rev': req.href.changeset(diff.old_rev), 'new_path': req.href.browser(diff.new_path, rev=diff.new_rev), 'old_path': req.href.browser(diff.old_path, rev=diff.old_rev) } }
|
acd9e25573f65bec86a5d3b8264eb729b139ba36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/acd9e25573f65bec86a5d3b8264eb729b139ba36/changeset.py
|
message = chgset.message or '--' if self.wiki_format_messages: message = wiki_to_html(message, self.env, req, escape_newlines=True) else: message = html.PRE(message)
|
def _changeset_title(rev): if restricted: return 'Changeset %s for %s' % (rev, path) else: return 'Changeset %s' % rev
|
acd9e25573f65bec86a5d3b8264eb729b139ba36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/acd9e25573f65bec86a5d3b8264eb729b139ba36/changeset.py
|
|
message = wiki_to_html(description, self.env, db,
|
message = wiki_to_html(description, self.env, req, db,
|
def get_timeline_events(self, req, start, stop, filters): if 'milestone' in filters: format = req.args.get('format') db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT completed,name,description FROM milestone " "WHERE completed>=%s AND completed<=%s", (start, stop,)) for completed, name, description in cursor: title = Markup('Milestone <em>%s</em> completed', name) if format == 'rss': href = req.abs_href.milestone(name) message = wiki_to_html(description, self.env, db, absurls=True) else: href = req.href.milestone(name) message = wiki_to_oneliner(description, self.env, db, shorten=True) yield 'milestone', href, title, completed, None, message or '--'
|
76f14030599ba2aed5c43613250b38946acde3cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/76f14030599ba2aed5c43613250b38946acde3cb/roadmap.py
|
(r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)" r"(\]\]|\((?P<macroargs>.*?)\)\]\]))"),
|
def process(self, req, text, in_paragraph=False): if self.error: text = system_message(Markup('Error: Failed to load processor ' '<code>%s</code>', self.name), self.error) else: text = self.processor(req, text) if in_paragraph: content_for_span = None interrupt_paragraph = False if isinstance(text, Element): tagname = text.tagname.lower() if tagname == 'div': class_ = text.attr.get('class_', '') if class_ and 'code' in class_: content_for_span = text.children else: interrupt_paragraph = True elif tagname == 'table': interrupt_paragraph = True else: match = re.match(self._code_block_re, text) if match: if match.group(1) and 'code' in match.group(1): content_for_span = match.group(2) else: interrupt_paragraph = True elif text.startswith('<table'): interrupt_paragraph = True if content_for_span: text = html.SPAN(class_='code-block')[content_for_span] elif interrupt_paragraph: text = "</p>%s<p>" % to_unicode(text) return text
|
6fb869d9fd6e67bd4358394bb9b0b71bfc3db785 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/6fb869d9fd6e67bd4358394bb9b0b71bfc3db785/formatter.py
|
|
line = 1
|
next_line = 1 line = 0
|
def suite(data=None, setup=None, file=__file__): suite = unittest.TestSuite() if not data: file = os.path.join(os.path.split(file)[0], 'wiki-tests.txt') data = open(file, 'r').read().decode('utf-8') tests = data.split('=' * 30) line = 1 for test in tests: if not test or test == '\n': continue blocks = test.split('-' * 30 + '\n') if len(blocks) != 3: continue input, page, oneliner = blocks tc = WikiTestCase(input, page, file, line) if setup: setup(tc) suite.addTest(tc) if oneliner: tc = OneLinerTestCase(input, oneliner[:-1], file, line) if setup: setup(tc) suite.addTest(tc) line += len(test.split('\n')) return suite
|
59819bde6b54c66e4a4b2a27f504ecb98c3e7597 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/59819bde6b54c66e4a4b2a27f504ecb98c3e7597/formatter.py
|
line += len(test.split('\n'))
|
def suite(data=None, setup=None, file=__file__): suite = unittest.TestSuite() if not data: file = os.path.join(os.path.split(file)[0], 'wiki-tests.txt') data = open(file, 'r').read().decode('utf-8') tests = data.split('=' * 30) line = 1 for test in tests: if not test or test == '\n': continue blocks = test.split('-' * 30 + '\n') if len(blocks) != 3: continue input, page, oneliner = blocks tc = WikiTestCase(input, page, file, line) if setup: setup(tc) suite.addTest(tc) if oneliner: tc = OneLinerTestCase(input, oneliner[:-1], file, line) if setup: setup(tc) suite.addTest(tc) line += len(test.split('\n')) return suite
|
59819bde6b54c66e4a4b2a27f504ecb98c3e7597 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/59819bde6b54c66e4a4b2a27f504ecb98c3e7597/formatter.py
|
|
open_tag_re = re.compile(r'<(\w+)\s.*?[^/]?>')
|
open_tag_re = re.compile(r'<(\w+)(\s.*)?[^/]?>')
|
def _html_splitlines(lines): """Tracks open and close tags in lines of HTML text and yields lines that have no tags spanning more than one line.""" open_tag_re = re.compile(r'<(\w+)\s.*?[^/]?>') close_tag_re = re.compile(r'</(\w+)>') open_tags = [] for line in lines: # Reopen tags still open from the previous line for tag in open_tags: line = tag.group(0) + line open_tags = [] # Find all tags opened on this line for tag in open_tag_re.finditer(line): open_tags.append(tag) # Find all tags closed on this line for ctag in close_tag_re.finditer(line): for otag in open_tags: if otag.group(1) == ctag.group(1): open_tags.remove(otag) break # Close all tags still open at the end of line, they'll get reopened at # the beginning of the next line for tag in open_tags: line += '</%s>' % tag.group(1) yield line
|
0da0762960d07f94d52ceea48316b898d060e518 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/0da0762960d07f94d52ceea48316b898d060e518/api.py
|
usage()
|
def _auth_callback(option, opt_str, value, parser, auths, cls): info = value.split(',', 3) if len(info) != 3: raise OptionValueError("Incorrect number of parameters for %s" % option) usage() env_name, filename, realm = info if env_name in auths: print >>sys.stderr, 'Ignoring duplicate authentication option for ' \ 'project: %s' % env_name else: auths[env_name] = cls(filename, realm)
|
2e9546de8f54e1df095989ae8fd92b8458a58557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2e9546de8f54e1df095989ae8fd92b8458a58557/standalone.py
|
|
"ORDER BY version DESC LIMIT 1", params=(title, cursor))
|
"ORDER BY version DESC LIMIT 1", cursor, params=(title,))
|
def _do_wiki_import(self, filename, title, cursor=None): if not os.path.isfile(filename): raise Exception, '%s is not a file' % filename
|
b44a782457336cd52fb7869321a591fbdf8f8c6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/b44a782457336cd52fb7869321a591fbdf8f8c6e/admin.py
|
ticket['description'] = wiki_to_oneliner(ticket['description'] or '', self.env, db)
|
ticket['description'] = wiki_to_html(ticket['description'] or '', self.env, req, db)
|
def display_html(self, req, query): req.hdf['title'] = 'Custom Query' add_stylesheet(req, 'report.css')
|
df0befa7b14c7bf26d8862d5faf46fc0743349fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/df0befa7b14c7bf26d8862d5faf46fc0743349fc/Query.py
|
message = wiki_to_html(message or '--', self.env, db)
|
message = wiki_to_html(message or '--', self.env, req, db)
|
def get_timeline_events(self, req, start, stop, filters): if 'ticket' in filters: format = req.args.get('format') sql = []
|
56e37872ef080212ce9ca61eedc647dcd187a361 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/56e37872ef080212ce9ca61eedc647dcd187a361/web_ui.py
|
clause.append('%s = \'%s\'' % (constraints[i], vals[j]))
|
clause.append('%s = \'%s\'' % (constraints[i], vals[j].value))
|
def render(self): self.perm.assert_permission(perm.TICKET_VIEW)
|
2efaf8f378fee962b98bca45ed962727c8a9c381 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2efaf8f378fee962b98bca45ed962727c8a9c381/Ticket.py
|
clause.append('%s = \'%s\'' % (constraints[i], vals))
|
clause.append('%s = \'%s\'' % (constraints[i], vals.value))
|
def render(self): self.perm.assert_permission(perm.TICKET_VIEW)
|
2efaf8f378fee962b98bca45ed962727c8a9c381 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/2efaf8f378fee962b98bca45ed962727c8a9c381/Ticket.py
|
col_width.append(max(len(unicode(d[idx])) for d in data))
|
col_width.append(max([len(unicode(d[idx])) for d in data]))
|
def print_table(data, headers=None, sep=' ', out=None): if out is None: out = sys.stdout charset = getattr(out, 'encoding', 'utf-8') data = list(data) if headers: data.insert(0, headers) elif not data: return num_cols = len(data[0]) # assumes all rows are of equal length col_width = [] for idx in range(num_cols): col_width.append(max(len(unicode(d[idx])) for d in data)) out.write('\n') for ridx, row in enumerate(data): for cidx, cell in enumerate(row): if headers and ridx == 0: sp = ('%%%ds' % len(sep)) % ' ' # No separator in header else: sp = sep if cidx + 1 == num_cols: sp = '' # No separator after last column line = (u'%%-%ds%s' % (col_width[cidx], sp)) % (cell or '') if isinstance(line, unicode): line = line.encode(charset, 'replace') out.write(line) out.write('\n') if ridx == 0 and headers: out.write(''.join(['-' for x in xrange(0, len(sep) * cidx + sum(col_width))])) out.write('\n') out.write('\n')
|
feae30252393c0200b7c4ea1f0cf07417ea5a456 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/feae30252393c0200b7c4ea1f0cf07417ea5a456/text.py
|
shortlog = wiki_to_oneliner(message, env, db, shorten=True)
|
shortlog = wiki_to_oneliner(message, env, db, shorten=True, absurls=absurls)
|
def get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: try: changeset = repos.get_changeset(rev) except NoSuchChangeset: changes[rev] = {} continue wiki_format = env.config['changeset'].getbool('wiki_format_messages') message = changeset.message or '--' if wiki_format: shortlog = wiki_to_oneliner(message, env, db, shorten=True) else: shortlog = Markup.escape(shorten_line(message)) if full: if wiki_format: message = wiki_to_html(message, env, req, db, absurls=(format == 'rss'), escape_newlines=True) else: message = html.PRE(message) else: message = shortlog if format == 'rss': if isinstance(shortlog, Markup): shortlog = shortlog.plaintext(keeplinebreaks=False) message = unicode(message) changes[rev] = { 'date_seconds': changeset.date, 'date': format_datetime(changeset.date), 'age': pretty_timedelta(changeset.date), 'author': changeset.author or 'anonymous', 'message': message, 'shortlog': shortlog, } return changes
|
d57eccce10b8dc108d44debf122c6307c95ebb1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d57eccce10b8dc108d44debf122c6307c95ebb1f/util.py
|
absurls=(format == 'rss'), escape_newlines=True)
|
absurls=absurls, escape_newlines=True)
|
def get_changes(env, repos, revs, full=None, req=None, format=None): db = env.get_db_cnx() changes = {} for rev in revs: try: changeset = repos.get_changeset(rev) except NoSuchChangeset: changes[rev] = {} continue wiki_format = env.config['changeset'].getbool('wiki_format_messages') message = changeset.message or '--' if wiki_format: shortlog = wiki_to_oneliner(message, env, db, shorten=True) else: shortlog = Markup.escape(shorten_line(message)) if full: if wiki_format: message = wiki_to_html(message, env, req, db, absurls=(format == 'rss'), escape_newlines=True) else: message = html.PRE(message) else: message = shortlog if format == 'rss': if isinstance(shortlog, Markup): shortlog = shortlog.plaintext(keeplinebreaks=False) message = unicode(message) changes[rev] = { 'date_seconds': changeset.date, 'date': format_datetime(changeset.date), 'age': pretty_timedelta(changeset.date), 'author': changeset.author or 'anonymous', 'message': message, 'shortlog': shortlog, } return changes
|
d57eccce10b8dc108d44debf122c6307c95ebb1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/d57eccce10b8dc108d44debf122c6307c95ebb1f/util.py
|
query_href = req.href.query(group=query.group, groupdesc=query.groupdesc and 1 or None, verbose=query.verbose and 1 or None, **query.constraints)
|
def display_html(self, context, query): req = context.req db = self.env.get_db_cnx() tickets = query.execute(req, db)
|
deceff61ea11a3edb845d5d742258b4ea748d1ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/deceff61ea11a3edb845d5d742258b4ea748d1ff/query.py
|
|
def display_html(self, context, query): req = context.req db = self.env.get_db_cnx() tickets = query.execute(req, db)
|
deceff61ea11a3edb845d5d742258b4ea748d1ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/deceff61ea11a3edb845d5d742258b4ea748d1ff/query.py
|
||
match = re.match(r'^/attachment/(ticket|wiki)(?:[/:](.*))?$',
|
match = re.match(r'^/(raw-)?attachment/([^/]+)(?:[/:](.*))?$',
|
def match_request(self, req): match = re.match(r'^/attachment/(ticket|wiki)(?:[/:](.*))?$', req.path_info) if match: req.args['type'] = match.group(1) req.args['path'] = match.group(2).replace(':', '/') return True
|
01d1598a9f5a2526e8b49b34e7e07fa896dbaec9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/01d1598a9f5a2526e8b49b34e7e07fa896dbaec9/attachment.py
|
req.args['type'] = match.group(1) req.args['path'] = match.group(2).replace(':', '/')
|
req.args['format'] = match.group(1) and 'raw' or '' req.args['type'] = match.group(2) req.args['path'] = match.group(3).replace(':', '/')
|
def match_request(self, req): match = re.match(r'^/attachment/(ticket|wiki)(?:[/:](.*))?$', req.path_info) if match: req.args['type'] = match.group(1) req.args['path'] = match.group(2).replace(':', '/') return True
|
01d1598a9f5a2526e8b49b34e7e07fa896dbaec9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/01d1598a9f5a2526e8b49b34e7e07fa896dbaec9/attachment.py
|
raw_href = attachment.href(req, format='raw')
|
raw_href = attachment.raw_href(req)
|
def _render_view(self, req, attachment): perm_map = {'ticket': 'TICKET_VIEW', 'wiki': 'WIKI_VIEW'} req.perm.require(perm_map[attachment.parent_type])
|
01d1598a9f5a2526e8b49b34e7e07fa896dbaec9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/01d1598a9f5a2526e8b49b34e7e07fa896dbaec9/attachment.py
|
if formatter.req:
|
if ns.startswith('raw'): href = attachment.raw_href(formatter.req) elif formatter.req:
|
def attachment_link(parent_type, parent_id, filename): href = formatter.href() try: attachment = Attachment(self.env, parent_type, parent_id, filename) if formatter.req: href = attachment.href(formatter.req) + params return html.A(label, class_='attachment', href=href, title='Attachment %s' % attachment.title) except TracError: return None
|
01d1598a9f5a2526e8b49b34e7e07fa896dbaec9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/01d1598a9f5a2526e8b49b34e7e07fa896dbaec9/attachment.py
|
return mime_type[ctpos + 8:]
|
return mimetype[ctpos + 8:]
|
def get_charset(mimetype): """Return the character encoding included in the given content type string, or `None` if `mimetype` is `None` or empty or if no charset information is available. """ if mimetype: ctpos = mimetype.find('charset=') if ctpos >= 0: return mime_type[ctpos + 8:]
|
ef6d58d9a4de3b02ab9df3cd989cf3a89cf0f5b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/ef6d58d9a4de3b02ab9df3cd989cf3a89cf0f5b4/api.py
|
def wiki_escape_newline(text): return text.replace(os.linesep, '[[BR]]' + os.linesep)
|
a46c0665e7a54d605327fc86bf0287924690ed0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a46c0665e7a54d605327fc86bf0287924690ed0a/util.py
|
||
if i < maxlen: shortline = text[:i]+' ...'
|
if i > -1 and i < maxlen: shortline = text[:i]+' ...'
|
def shorten_line(text, maxlen = 75): if not text: return '' i = text.find('[[BR]]') if i < maxlen: shortline = text[:i]+' ...' elif len(text) < maxlen: shortline = text else: i = text[:maxlen].rfind(' ') if i == -1: i = maxlen shortline = text[:i]+' ...' return shortline
|
a46c0665e7a54d605327fc86bf0287924690ed0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/a46c0665e7a54d605327fc86bf0287924690ed0a/util.py
|
'false',
|
'true',
|
def __getattr__(self, str): return self[str]
|
db1a6ff23c162ce618c97e6e9f8ce5efb2becd7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/db1a6ff23c162ce618c97e6e9f8ce5efb2becd7a/changeset.py
|
value['date'] = format_date(cell) value['time'] = format_time(cell) value['datetime'] = format_datetime(cell) value['gmt'] = http_date(cell)
|
if cell == 'None': value['date'] = value['time'] = cell value['datetime'] = value['gmt'] = cell else: value['date'] = format_date(cell) value['time'] = format_time(cell) value['datetime'] = format_datetime(cell) value['gmt'] = http_date(cell)
|
def sortkey(row): val = row[colIndex] if isinstance(val, basestring): val = val.lower() return val
|
24069c8f030fefc95c64970e7fe326545d68aceb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/24069c8f030fefc95c64970e7fe326545d68aceb/report.py
|
priority_mapping = {'highest': '1', 'high': '3', 'normal': '5', 'low': '7', 'lowest': '9'}
|
cursor = db.cursor() cursor.execute("SELECT name,value FROM enum WHERE type='priority'") priorities = {} for name, value in cursor: priorities[name] = float(value) def get_priority(ticket): value = priorities.get(ticket['priority']) if value: return int(value * 9 / len(priorities))
|
def render_ics(self, req, db, milestones): req.send_response(200) req.send_header('Content-Type', 'text/calendar;charset=utf-8') req.end_headers()
|
f1247177d8bbe9edddd9819dd09d7c698998d191 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f1247177d8bbe9edddd9819dd09d7c698998d191/Roadmap.py
|
write_prop('URL', req.base_url + '/milestone/' + milestone['name']) if milestone.has_key('description'): write_prop('DESCRIPTION', milestone['description_text'])
|
write_prop('URL', req.base_url + '/milestone/' + milestone['name']) if milestone.has_key('description_source'): write_prop('DESCRIPTION', milestone['description_source'])
|
def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params)
|
f1247177d8bbe9edddd9819dd09d7c698998d191 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f1247177d8bbe9edddd9819dd09d7c698998d191/Roadmap.py
|
write_prop('PRIORITY', priority_mapping[ticket['priority']])
|
priority = get_priority(ticket) if priority: write_prop('PRIORITY', str(priority))
|
def write_utctime(name, value, params={}): write_prop(name, strftime('%Y%m%dT%H%M%SZ', value), params)
|
f1247177d8bbe9edddd9819dd09d7c698998d191 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/f1247177d8bbe9edddd9819dd09d7c698998d191/Roadmap.py
|
href = Href(req.base_path).chrome
|
href = req.href if not filename.startswith('/'): href = href.chrome
|
def add_stylesheet(req, filename, mimetype='text/css'): """Add a link to a style sheet to the HDF data set so that it gets included in the generated HTML page. """ if filename.startswith('common/') and 'htdocs_location' in req.chrome: href = Href(req.chrome['htdocs_location']) filename = filename[7:] else: href = Href(req.base_path).chrome add_link(req, 'stylesheet', href(filename), mimetype=mimetype)
|
1480ce893410f394fd9e2d2ec4ceb87ea9f6e7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/1480ce893410f394fd9e2d2ec4ceb87ea9f6e7ae/chrome.py
|
"""Add a reference to an external javascript file to the template."""
|
"""Add a reference to an external javascript file to the template. If the filename is absolute (i.e. starts with a slash), the generated link will be based off the application root path. If it is relative, the link will be based off the `/chrome/` path. """
|
def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template.""" scriptset = req.chrome.setdefault('trac.chrome.scriptset', set()) if filename in scriptset: return False # Already added that script if filename.startswith('common/') and 'htdocs_location' in req.chrome: href = Href(req.chrome['htdocs_location']) path = filename[7:] else: href = Href(req.base_path).chrome path = filename script = {'href': href(path), 'type': mimetype} req.chrome.setdefault('scripts', []).append(script) scriptset.add(filename)
|
1480ce893410f394fd9e2d2ec4ceb87ea9f6e7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/1480ce893410f394fd9e2d2ec4ceb87ea9f6e7ae/chrome.py
|
href = Href(req.base_path).chrome
|
href = req.href if not filename.startswith('/'): href = href.chrome
|
def add_script(req, filename, mimetype='text/javascript'): """Add a reference to an external javascript file to the template.""" scriptset = req.chrome.setdefault('trac.chrome.scriptset', set()) if filename in scriptset: return False # Already added that script if filename.startswith('common/') and 'htdocs_location' in req.chrome: href = Href(req.chrome['htdocs_location']) path = filename[7:] else: href = Href(req.base_path).chrome path = filename script = {'href': href(path), 'type': mimetype} req.chrome.setdefault('scripts', []).append(script) scriptset.add(filename)
|
1480ce893410f394fd9e2d2ec4ceb87ea9f6e7ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/1480ce893410f394fd9e2d2ec4ceb87ea9f6e7ae/chrome.py
|
target = fullmatch.group('stgt') if target[0] in "'\"": target = target[1:-1]
|
target = self._unquote(fullmatch.group('stgt'))
|
def _shref_formatter(self, match, fullmatch): ns = fullmatch.group('sns') target = fullmatch.group('stgt') if target[0] in "'\"": target = target[1:-1] return self._make_link(ns, target, match, match)
|
1f03dd3afd00a1741a5cf57f41956c7034b3ba35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/1f03dd3afd00a1741a5cf57f41956c7034b3ba35/formatter.py
|
target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1]
|
target = self._unquote(fullmatch.group('ltgt'))
|
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1] label = fullmatch.group('label') if not label: # e.g. `[http://target]` or `[wiki:target]` if target: if target.startswith('//'): # for `[http://target]` label = ns+':'+target # use `http://target` else: # for `wiki:target` label = target # use only `target` else: # e.g. `[search:]` label = ns if label and label[0] in ("'",'"'): label = label[1:-1] rel = fullmatch.group('rel') if rel: return self._make_relative_link(rel, label or rel) else: return self._make_link(ns, target, match, label)
|
1f03dd3afd00a1741a5cf57f41956c7034b3ba35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/1f03dd3afd00a1741a5cf57f41956c7034b3ba35/formatter.py
|
if label and label[0] in ("'",'"'): label = label[1:-1]
|
label = self._unquote(label)
|
def _lhref_formatter(self, match, fullmatch): ns = fullmatch.group('lns') target = fullmatch.group('ltgt') if target and target[0] in ("'",'"'): target = target[1:-1] label = fullmatch.group('label') if not label: # e.g. `[http://target]` or `[wiki:target]` if target: if target.startswith('//'): # for `[http://target]` label = ns+':'+target # use `http://target` else: # for `wiki:target` label = target # use only `target` else: # e.g. `[search:]` label = ns if label and label[0] in ("'",'"'): label = label[1:-1] rel = fullmatch.group('rel') if rel: return self._make_relative_link(rel, label or rel) else: return self._make_link(ns, target, match, label)
|
1f03dd3afd00a1741a5cf57f41956c7034b3ba35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/1f03dd3afd00a1741a5cf57f41956c7034b3ba35/formatter.py
|
self.changeno = 0
|
self.changeno = -1
|
def __init__(self, hdf, prefix='changeset.diff'): self.block = [] self.ttype = None self.p_block = [] self.p_type = None self.hdf = hdf self.prefix = prefix self.changeno = 0 self.blockno = 0
|
fadface95df7a3617a141c86fb5ec1a9219977d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fadface95df7a3617a141c86fb5ec1a9219977d6/Changeset.py
|
self.blockno += 1
|
def print_block (self): self.blockno += 1 prefix = '%s.changes.%d.blocks.%d' % (self.prefix, self.changeno, self.blockno) if self.p_type == '-' and self.ttype == '+': self._write_block(prefix, 'mod', old=string.join(self.p_block, '<br />'), new=string.join(self.block, '<br />')) elif self.ttype == '+': self._write_block(prefix, 'add', new=string.join(self.block, '<br />')) elif self.ttype == '-': self._write_block(prefix, 'rem', old=string.join(self.block, '<br />')) elif self.ttype == ' ': self._write_block(prefix, 'unmod', old=string.join(self.block, '<br />'), new=string.join(self.block, '<br />')) self.block = self.p_block = []
|
fadface95df7a3617a141c86fb5ec1a9219977d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fadface95df7a3617a141c86fb5ec1a9219977d6/Changeset.py
|
|
self.print_block()
|
def writeline(self, text): match = header_re.search(text) if match: self.hdf.setValue('%s.name.old' % self.prefix, match.group(1)) self.hdf.setValue('%s.name.new' % self.prefix, match.group(2)) return if text[0:2] in ['++', '--']: return match = line_re.search(text) if match: self.changeno += 1 pfx = '%s.changes.%d.line' % (self.prefix, self.changeno) self.print_block() self.hdf.setValue('%s.old' % pfx, match.group(1)) self.hdf.setValue('%s.new' % pfx, match.group(3)) return ttype = text[0] text = text[1:] text = space_re.sub(' ', text.expandtabs(8)) if ttype == self.ttype: self.block.append(text) else: if ttype == '+' and self.ttype == '-': self.p_block = self.block self.p_type = self.ttype else: self.print_block() self.block = [text] self.ttype = ttype
|
fadface95df7a3617a141c86fb5ec1a9219977d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fadface95df7a3617a141c86fb5ec1a9219977d6/Changeset.py
|
|
def add_file(self, path, parent_baton, copyfrom_path, copyfrom_revision, file_pool): return [None, path, file_pool] def open_file(self, path, parent_baton, base_revision, file_pool): return [path, path, file_pool] def apply_textdelta(self, file_baton, base_checksum): self.print_diff (*file_baton)
|
def add_file(self, path, parent_baton, copyfrom_path, copyfrom_revision, file_pool): return [None, path, file_pool]
|
fadface95df7a3617a141c86fb5ec1a9219977d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/fadface95df7a3617a141c86fb5ec1a9219977d6/Changeset.py
|
|
return self.req.headers_out.get(name)
|
return self.req.headers_in.get(name)
|
def get_header(self, name): return self.req.headers_out.get(name)
|
212d689e7637715dfb9ca1f553dcdf1dcb289f7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/212d689e7637715dfb9ca1f553dcdf1dcb289f7c/ModPythonHandler.py
|
def init(req): global env try: options = req.req.get_options() if not options.has_key('TracEnv'): raise EnvironmentError, \ 'Missing PythonOption "TracEnv". Trac requires this option '\ 'to point to a valid Trac Environment.' env_path = options['TracEnv'] env = Environment.Environment(env_path) version = env.get_version() if version < Environment.db_version: raise TracError('The Trac environment needs to be upgraded. ' 'Run "trac-admin %s upgrade"' % path) elif version > Environment.db_version: raise TracError('Unknown Trac Environment version (%d).' % version) env.href = Href.Href(req.cgi_location) env.abs_href = Href.Href(req.base_url) database = env.get_db_cnx() # Let the wiki module build a dictionary of all page names Wiki.populate_page_dict(database, env) except Exception, e: apache.log_error(str(e)) raise apache.SERVER_RETURN, apache.HTTP_INTERNAL_SERVER_ERROR
|
212d689e7637715dfb9ca1f553dcdf1dcb289f7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/212d689e7637715dfb9ca1f553dcdf1dcb289f7c/ModPythonHandler.py
|
||
req.redirect(self.env.href.ticket(ticket.id))
|
if req.args.get('attachment'): req.redirect(self.env.href.attachment('ticket', ticket.id, action='new')) else: req.redirect(self.env.href.ticket(ticket.id))
|
def _do_create(self, req, db): if not req.args.get('summary'): raise TracError('Tickets must contain a summary.')
|
79b800fafc54079245b6121b27aa22ae5770ecd2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/79b800fafc54079245b6121b27aa22ae5770ecd2/web_ui.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.