本文整理汇总了Python中svn.core.svn_pool_create函数的典型用法代码示例。如果您正苦于以下问题:Python svn_pool_create函数的具体用法?Python svn_pool_create怎么用?Python svn_pool_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了svn_pool_create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent_pool=None):
global application_pool
self._parent_pool = parent_pool or application_pool
if self._parent_pool:
self._pool = core.svn_pool_create(self._parent_pool())
else:
core.apr_initialize()
application_pool = self
self._pool = core.svn_pool_create(None)
self._mark_valid()
开发者ID:damoxc,项目名称:snakepit,代码行数:12,代码来源:svnclient.py
示例2: setUp
def setUp(self):
dumpfile = open(os.path.join(os.path.split(__file__)[0],
'svnrepos.dump'))
svn_fs._import_svn()
core.apr_initialize()
pool = core.svn_pool_create(None)
dumpstream = None
try:
if os.path.exists(REPOS_PATH):
print 'trouble ahead with db/rep-cache.db... see #8278'
r = repos.svn_repos_create(REPOS_PATH, '', '', None, None, pool)
if hasattr(repos, 'svn_repos_load_fs2'):
repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
repos.svn_repos_load_uuid_default, '',
0, 0, None, pool)
else:
dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
repos.svn_repos_load_fs(r, dumpstream, None,
repos.svn_repos_load_uuid_default, '',
None, None, pool)
finally:
if dumpstream:
core.svn_stream_close(dumpstream)
core.svn_pool_destroy(pool)
core.apr_terminate()
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:26,代码来源:svn_fs.py
示例3: add_history
def add_history(self, path, revision, pool):
# If filtering, only add the path and revision to the histories
# list if they were actually changed in this revision (where
# change means the path itself was changed, or one of its parents
# was copied). This is useful for omitting bubble-up directory
# changes.
if not self.show_all_logs:
rev_root = fs.revision_root(self.fs_ptr, revision, pool)
changed_paths = fs.paths_changed(rev_root, pool)
paths = changed_paths.keys()
if path not in paths:
# Look for a copied parent
test_path = path
found = 0
subpool = core.svn_pool_create(pool)
while 1:
core.svn_pool_clear(subpool)
off = string.rfind(test_path, '/')
if off < 0:
break
test_path = test_path[0:off]
if test_path in paths:
copyfrom_rev, copyfrom_path = \
fs.copied_from(rev_root, test_path, subpool)
if copyfrom_rev >= 0 and copyfrom_path:
found = 1
break
core.svn_pool_destroy(subpool)
if not found:
return
self.histories[revision] = _cleanup_path(path)
开发者ID:meyersh,项目名称:gimli-public_html,代码行数:31,代码来源:__init__.py
示例4: idKeyUpdate
def idKeyUpdate(self, deltas):
""" Convert the SCCS keywords inside of the supplied deltas to
subversion keywords. """
# Split up the deltas array into smaller sub-arrays, otherwise
# we choke running out of memory due to really large changesets
# like the CDDL 2005/06/08 putback in ON that touched every file
while len(deltas):
if len(deltas) > 1000:
print "partitioning deltas into smaller new_deltas"
new_deltas = deltas[:1000]
deltas = deltas[1000:]
""" Convert the SCCS keywords inside of the supplied deltas to
subversion keywords. """
subpool = core.svn_pool_create(self.pool)
(revision,
transaction,
root) = self._revisionSetup(subpool,
options.userid,
"Automated keyword replacement")
for delta in new_deltas:
if isTextFilename(delta.getFilename()):
originalContents = delta.getFileContents("-k")
updatedContents = keywordSubstitution(originalContents)
if originalContents != updatedContents:
handler, baton = fs.apply_textdelta(root,
delta.getRepositoryName(),
None, None, subpool)
svn.delta.svn_txdelta_send_string(updatedContents,
handler, baton, subpool)
print "sending ", delta.getRepositoryName()
print "committing version ",
print self._commit(revision, delta.getDate(), transaction, subpool)
core.svn_pool_destroy(subpool)
开发者ID:tgreaves,项目名称:sccs2svn,代码行数:35,代码来源:sccs2svn.py
示例5: propertyUpdate
def propertyUpdate(self, filenames):
""" Set the keywords property for the supplied filenames. """
# Split up the filenames array into smaller sub-arrays, otherwise
# we choke running out of memory due to a really large SCCS
# repository like ON
while len(filenames):
if len(filenames) > 3000:
print "partitioning filenames into smaller new_filenames"
new_filenames = filenames[:3000]
filenames = filenames[3000:]
""" Set the keywords property for the supplied filenames. """
subpool = core.svn_pool_create(self.pool)
(revision,
transaction,
root) = self._revisionSetup(subpool,
options.userid,
"Automated property set")
for filename in new_filenames:
if isTextFilename(filename):
print "property set for ", filename
fs.change_node_prop(root, filename,
core.SVN_PROP_KEYWORDS,
"LastChangedDate LastChangedRevision LastChangedBy HeadURL Id",
subpool)
fs.change_node_prop(root, filename,
core.SVN_PROP_EOL_STYLE,
"native",
subpool)
else:
print "skipping property set for ", filename
self._commit(revision, subversionTime(time.localtime()),
transaction, subpool)
core.svn_pool_destroy(subpool)
开发者ID:tgreaves,项目名称:sccs2svn,代码行数:35,代码来源:sccs2svn.py
示例6: __init__
def __init__(self, name, rootpath):
# Init the client app
core.apr_initialize()
pool = core.svn_pool_create(None)
core.svn_config_ensure(None, pool)
# Start populating our members
self.pool = pool
self.name = name
self.rootpath = rootpath
# Setup the client context baton, complete with non-prompting authstuffs.
ctx = client.svn_client_ctx_t()
providers = []
providers.append(client.svn_client_get_simple_provider(pool))
providers.append(client.svn_client_get_username_provider(pool))
providers.append(client.svn_client_get_ssl_server_trust_file_provider(pool))
providers.append(client.svn_client_get_ssl_client_cert_file_provider(pool))
providers.append(client.svn_client_get_ssl_client_cert_pw_file_provider(pool))
ctx.auth_baton = core.svn_auth_open(providers, pool)
ctx.config = core.svn_config_get_config(None, pool)
self.ctx = ctx
ra_callbacks = ra.svn_ra_callbacks_t()
ra_callbacks.auth_baton = ctx.auth_baton
self.ra_session = ra.svn_ra_open(self.rootpath, ra_callbacks, None,
ctx.config, pool)
self.youngest = ra.svn_ra_get_latest_revnum(self.ra_session, pool)
self._dirent_cache = { }
开发者ID:foresthz,项目名称:fusion5.1,代码行数:29,代码来源:__init__.py
示例7: close_file
def close_file(self, file_baton, text_checksum):
changed, path = file_baton
if len(path) < 3 or path[-3:] != ".po" or not changed:
# This is not a .po file, or it hasn't changed
return
try:
# Read the file contents through a validating UTF-8 decoder
subpool = core.svn_pool_create(self.pool)
checker = MsgFmtChecker()
try:
stream = core.Stream(fs.file_contents(self.txn_root, path, subpool))
reader = codecs.getreader("UTF-8")(stream, "strict")
writer = codecs.getwriter("UTF-8")(checker, "strict")
while 1:
data = reader.read(core.SVN_STREAM_CHUNK_SIZE)
if not data:
break
writer.write(data)
if not checker.close():
sys.exit("PO format check failed for '" + path + "'")
except UnicodeError:
sys.exit("PO file is not in UTF-8: '" + path + "'")
finally:
core.svn_pool_destroy(subpool)
开发者ID:gotgit,项目名称:doc-svn_hooks,代码行数:25,代码来源:verify-po.py
示例8: svn_uri
def svn_uri(path):
# init
core.apr_initialize()
pool = core.svn_pool_create(None)
core.svn_config_ensure(None, pool)
# get commit date
uri = client.svn_client_url_from_path(path, pool)
# cleanup
core.svn_pool_destroy(pool)
core.apr_terminate()
return uri
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:11,代码来源:repostats.py
示例9: __init__
def __init__(self, name, rootpath, svn_path):
if not os.path.isdir(rootpath):
raise vclib.ReposNotFound(name)
# Initialize some stuff.
self.pool = None
self.apr_init = 0
self.rootpath = rootpath
self.name = name
self.svn_client_path = os.path.normpath(os.path.join(svn_path, 'svn'))
# Register a handler for SIGTERM so we can have a chance to
# cleanup. If ViewVC takes too long to start generating CGI
# output, Apache will grow impatient and SIGTERM it. While we
# don't mind getting told to bail, we want to gracefully close the
# repository before we bail.
def _sigterm_handler(signum, frame, self=self):
self._close()
sys.exit(-1)
try:
signal.signal(signal.SIGTERM, _sigterm_handler)
except ValueError:
# This is probably "ValueError: signal only works in main
# thread", which will get thrown by the likes of mod_python
# when trying to install a signal handler from a thread that
# isn't the main one. We'll just not care.
pass
# Initialize APR and get our top-level pool.
core.apr_initialize()
self.apr_init = 1
self.pool = core.svn_pool_create(None)
self.scratch_pool = core.svn_pool_create(self.pool)
# Open the repository and init some other variables.
self.repos = repos.svn_repos_open(rootpath, self.pool)
self.fs_ptr = repos.svn_repos_fs(self.repos)
self.youngest = fs.youngest_rev(self.fs_ptr, self.pool)
self._fsroots = {}
开发者ID:meyersh,项目名称:gimli-public_html,代码行数:39,代码来源:__init__.py
示例10: remove
def remove(self, filenames):
""" Remove the supplied filenames file from the repository. """
subpool = core.svn_pool_create(self.pool)
(revision,
transaction,
root) = self._revisionSetup(subpool,
options.userid,
"Automated SCCS conversion removal")
for file in filenames:
print "removing ", file
fs.delete(root, file, subpool)
self._commit(revision, subversionTime(time.localtime()),
transaction, subpool)
core.svn_pool_destroy(subpool)
开发者ID:tgreaves,项目名称:sccs2svn,代码行数:15,代码来源:sccs2svn.py
示例11: get_logs
def get_logs(svnrepos, full_name, rev, files):
fsroot = svnrepos._getroot(rev)
subpool = core.svn_pool_create(svnrepos.pool)
for file in files:
core.svn_pool_clear(subpool)
path = _fs_path_join(full_name, file.name)
rev = _get_last_history_rev(fsroot, path, subpool)
datestr, author, msg = _fs_rev_props(svnrepos.fs_ptr, rev, subpool)
date = _datestr_to_date(datestr, subpool)
file.rev = str(rev)
file.date = date
file.author = author
file.log = msg
if file.kind == vclib.FILE:
file.size = fs.file_length(fsroot, path, subpool)
core.svn_pool_destroy(subpool)
开发者ID:meyersh,项目名称:gimli-public_html,代码行数:16,代码来源:__init__.py
示例12: main
def main():
try:
opts, args = my_getopt(sys.argv[1:], "h?f", ["help", "fix"])
except Exception as e:
sys.stderr.write(""" Improperly used """)
sys.exit(1)
if len(args) == 1:
wcpath = args[0]
wcpath = os.path.abspath(wcpath)
else:
usage()
sys.exit(1)
fix = 0
current_path = os.getcwd()
hash_file = os.path.join(current_path, ".hashfile")
newmergeinfo_file = os.path.join(current_path, ".newmergeinfo")
temp_pool = core.svn_pool_create()
ctx = client.svn_client_create_context(temp_pool)
depth = core.svn_depth_infinity
revision = core.svn_opt_revision_t()
revision.kind = core.svn_opt_revision_unspecified
for opt, values in opts:
if opt == "--help" or opt in ("-h", "-?"):
usage()
elif opt == "--fix" or opt == "-f":
fix = 1
# Check for any local modifications in the working copy
check_local_modifications(wcpath, temp_pool)
parsed_original_mergeinfo = get_original_mergeinfo(wcpath, revision,
depth, ctx, temp_pool)
repo_root = client.svn_client_root_url_from_path(wcpath, ctx, temp_pool)
core.svn_config_ensure(None)
if fix == 0:
sanitize_mergeinfo(parsed_original_mergeinfo, repo_root, wcpath, ctx,
hash_file, newmergeinfo_file, temp_pool)
if fix == 1:
fix_sanitized_mergeinfo(parsed_original_mergeinfo, repo_root, wcpath,
ctx, hash_file, newmergeinfo_file, temp_pool)
开发者ID:svn2github,项目名称:subversion,代码行数:47,代码来源:mergeinfo-sanitizer.py
示例13: _addDirectories
def _addDirectories(self, delta):
""" Make sure that all of the directories needed for delta are added. """
directoriesToAdd = self._directoriesToAdd(delta)
if len(directoriesToAdd) == 0:
return
subpool = core.svn_pool_create(self.pool)
(revision, transaction, root) = \
self._revisionSetup(subpool,
options.userid,
"Automatic directory addition")
for directory in directoriesToAdd:
print "adding directory", directory
print delta.getDate()
fs.make_dir(root, directory, subpool)
self.addedDirectories[directory] = 1
self._commit(revision, delta.getDate(), transaction, subpool)
core.svn_pool_destroy(subpool)
开发者ID:tgreaves,项目名称:sccs2svn,代码行数:18,代码来源:sccs2svn.py
示例14: add
def add(self, deltas):
""" Add the supplied set of deltas to the repository. They will
all be added with the same user name, date, and comment. """
# Split up the deltas array into smaller sub-arrays, otherwise
# we choke running out of memory due to really large changesets
# like the CDDL 2005/06/08 putback in ON that touched every file
while len(deltas):
if len(deltas) > 1000:
print "partitioning deltas into smaller new_deltas"
new_deltas = deltas[:1000]
deltas = deltas[1000:]
# Add all of the directories first, or we will be trying
# to cross transactions, which is bad.
for delta in new_deltas:
self._addDirectories(delta)
print "preparing %s version %s (%s) by %s" % (delta.pathname, delta.version, delta.date, delta.author)
subpool = core.svn_pool_create(self.pool)
(revision, transaction, root) = self._revisionSetup(subpool,
new_deltas[0].author,
new_deltas[0].comment)
for delta in new_deltas:
subversionPath = delta.getRepositoryName()
kind = fs.check_path(root, subversionPath, subpool)
if kind == core.svn_node_none:
fs.make_file(root, subversionPath, subpool)
elif kind == core.svn_node_dir:
raise EnvironmentError(subversionPath +
" already present as a directory.")
handler, baton = fs.apply_textdelta(root, subversionPath,
None, None, subpool)
svn.delta.svn_txdelta_send_string(delta.getFileContents(),
handler, baton, subpool)
if delta.version.isdigit:
fs.change_node_prop(root, subversionPath, 'sccs:sid', delta.version, subpool)
print "sending ", subversionPath, delta.getDate(), "by", delta.author
print "committing version ",
print self._commit(revision, delta.getDate(), transaction, subpool)
core.svn_pool_destroy(subpool)
开发者ID:cfuhrman,项目名称:sccs2svn,代码行数:44,代码来源:sccs2svn.py
示例15: get_logs
def get_logs(svnrepos, full_name, rev, files):
dirents = svnrepos._get_dirents(full_name, rev)
subpool = core.svn_pool_create(svnrepos.pool)
rev_info_cache = { }
for file in files:
core.svn_pool_clear(subpool)
entry = dirents[file.name]
if rev_info_cache.has_key(entry.created_rev):
rev, author, date, log = rev_info_cache[entry.created_rev]
else:
### i think this needs some get_last_history action to be accurate
rev, author, date, log, changes = \
_get_rev_details(svnrepos, entry.created_rev, subpool)
rev_info_cache[entry.created_rev] = rev, author, date, log
file.rev = rev
file.author = author
file.date = _datestr_to_date(date, subpool)
file.log = log
file.size = entry.size
core.svn_pool_destroy(subpool)
开发者ID:foresthz,项目名称:fusion5.1,代码行数:20,代码来源:__init__.py
示例16: _fetch_log
def _fetch_log(svnrepos, full_name, which_rev, options, pool):
revs = []
if options.get('svn_latest_log', 0):
rev = _log_helper(svnrepos, which_rev, full_name, pool)
if rev:
revs.append(rev)
else:
history_set = _get_history(svnrepos, full_name, which_rev, options)
history_revs = history_set.keys()
history_revs.sort()
history_revs.reverse()
subpool = core.svn_pool_create(pool)
for history_rev in history_revs:
core.svn_pool_clear(subpool)
rev = _log_helper(svnrepos, history_rev, history_set[history_rev],
subpool)
if rev:
revs.append(rev)
core.svn_pool_destroy(subpool)
return revs
开发者ID:meyersh,项目名称:gimli-public_html,代码行数:21,代码来源:__init__.py
示例17: close_file
def close_file(self, file_baton, text_checksum):
changed, path = file_baton
if len(path) < 3 or path.lower()[-3:] != '.py' or not changed:
# This is not a .py file, don't care about tabs
# TODO - only look inside trunk
return
# Read the file contents through a tab-finder
subpool = core.svn_pool_create(self.pool)
stream = core.Stream(fs.file_contents(self.txn_root, path, subpool))
data = stream.read() # core.SVN_STREAM_CHUNK_SIZE)
for line in data.splitlines():
if _tabs.match(line):
core.svn_pool_destroy(subpool)
msg = ("Python file contains lines that begin with tabs: '%s'\n"
"There may be others as well." % (path,))
sys.stderr.write(msg)
sys.exit(1)
core.svn_pool_destroy(subpool)
开发者ID:BackupTheBerlios,项目名称:vellum-svn,代码行数:22,代码来源:pre-commit.py
示例18: setUp
def setUp(self):
dumpfile = open(os.path.join(os.path.split(__file__)[0],
'svnrepos.dump'))
core.apr_initialize()
pool = core.svn_pool_create(None)
dumpstream = None
try:
r = repos.svn_repos_create(REPOS_PATH, '', '', None, None, pool)
if hasattr(repos, 'svn_repos_load_fs2'):
repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
repos.svn_repos_load_uuid_default, '',
0, 0, None, pool)
else:
dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
repos.svn_repos_load_fs(r, dumpstream, None,
repos.svn_repos_load_uuid_default, '',
None, None, pool)
finally:
if dumpstream:
core.svn_stream_close(dumpstream)
core.svn_pool_destroy(pool)
core.apr_terminate()
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:23,代码来源:svn_fs.py
示例19: setupClass
def setupClass(cls):
svn_fs._import_svn()
core.apr_initialize()
pool = core.svn_pool_create(None)
dumpstream = None
cls.repos_path = tempfile.mkdtemp(prefix='svn-tmp')
shutil.rmtree(cls.repos_path)
dumpfile = open(os.path.join(os.path.split(__file__)[0], 'svn.dump'))
try:
r = repos.svn_repos_create(cls.repos_path, '', '', None, None, pool)
if hasattr(repos, 'svn_repos_load_fs2'):
repos.svn_repos_load_fs2(r, dumpfile, StringIO(),
repos.svn_repos_load_uuid_default, '',
0, 0, None, pool)
else:
dumpstream = core.svn_stream_from_aprfile(dumpfile, pool)
repos.svn_repos_load_fs(r, dumpstream, None,
repos.svn_repos_load_uuid_default, '',
None, None, pool)
finally:
if dumpstream:
core.svn_stream_close(dumpstream)
core.svn_pool_destroy(pool)
core.apr_terminate()
开发者ID:getpenelope,项目名称:fulltextsearchplugin,代码行数:24,代码来源:fulltextsearch.py
示例20: keywordPropertyUpdate
def keywordPropertyUpdate(self, files):
""" Does the following to text files:
1) Sets svn:keywords property
2) Replace SCCS keywords with SVN equivalents
Note that while this will be treated as a separate transaction,
the transaction date will be set to the last known date for the
given file
"""
# Break up files into groups in order to avoid
# potential "Too many open files" errors thrown when
# committing large changesets
counter = 0
filesPerCommit = 256
for filename, version in files.iteritems():
if counter%filesPerCommit == 0:
if counter > 1:
print "committing version ",
print self._commit(revision, subversionTime(localtz.localize(datetime.now())),
transaction, subpool)
core.svn_pool_destroy(subpool)
subpool = core.svn_pool_create(self.pool)
(revision, transaction, root ) = \
self._revisionSetup(subpool, options.userid,
"Automated SCCS keyword -> svn:keyword conversion\n")
if isTextFilename(filename):
print filename + ":"
print " ... Setting svn:keywords property"
fs.change_node_prop(root, filename,
core.SVN_PROP_KEYWORDS,
"LastChangedDate LastChangedRevision LastChangedBy HeadURL Id",
subpool)
fs.change_node_prop(root, filename,
core.SVN_PROP_EOL_STYLE,
"native",
subpool)
oldFileContents = version.getFileContents("-k")
newFileContents = keywordSubstitution(oldFileContents)
if oldFileContents != newFileContents:
print " ... keywords converted"
handler, baton = fs.apply_textdelta(root,
version.getRepositoryName(),
None, None, subpool)
svn.delta.svn_txdelta_send_string(newFileContents,
handler, baton, subpool)
print " ... sending"
else:
print "skipping ", filename
# Note we must unset sccs:sid since it no longer applies
fs.change_node_prop(root, filename,
'sccs:sid', None, subpool)
counter += 1
# Commit any stragglers
print "committing version ",
print self._commit(revision, subversionTime(localtz.localize(datetime.now())),
transaction, subpool)
core.svn_pool_destroy(subpool)
开发者ID:cfuhrman,项目名称:sccs2svn,代码行数:64,代码来源:sccs2svn.py
注:本文中的svn.core.svn_pool_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论