当前位置: 首页>>代码示例>>Python>>正文


Python repos.fs函数代码示例

本文整理汇总了Python中svn.repos.fs函数的典型用法代码示例。如果您正苦于以下问题:Python fs函数的具体用法?Python fs怎么用?Python fs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

  def setUp(self):
    """Load a Subversion repository"""
    self.temper = utils.Temper()
    (self.repos, self.repos_path, self.repos_uri) = self.temper.alloc_known_repo(
      'trac/versioncontrol/tests/svnrepos.dump', suffix='-repository')
    self.fs = repos.fs(self.repos)
    self.rev = fs.youngest_rev(self.fs)
    self.tmpfile = None
    self.unistr = u'⊙_ʘ'
    tmpfd, self.tmpfile = mkstemp()

    tmpfp = os.fdopen(tmpfd, "wb")

    # Use a unicode file to ensure proper non-ascii handling.
    tmpfp.write(self.unistr.encode('utf8'))

    tmpfp.close()

    clientctx = client.svn_client_create_context()
    clientctx.log_msg_func3 = client.svn_swig_py_get_commit_log_func
    clientctx.log_msg_baton3 = self.log_message_func

    providers = [
       client.svn_client_get_simple_provider(),
       client.svn_client_get_username_provider(),
    ]

    clientctx.auth_baton = core.svn_auth_open(providers)

    commitinfo = client.import2(self.tmpfile,
                                urljoin(self.repos_uri +"/", "trunk/UniTest.txt"),
                                True, True,
                                clientctx)

    self.commitedrev = commitinfo.revision
开发者ID:svn2github,项目名称:subversion,代码行数:35,代码来源:fs.py

示例2: __init__

  def __init__(self, path, rev=None, txn=None, cmd=None):
    """
    path  - path to repository
    rev   - revision number
    txn   - name of transaction (usually the one about to be committed)
    cmd   - if set, specifies cmd_* method to execute

    txn takes precedence over rev; if both are None, inspect the head revision
    """
    path = core.svn_path_canonicalize(path)
    repos_ptr = repos.open(path)
    self.fs_ptr = repos.fs(repos_ptr)

    # if set, txn takes precendence
    if txn:
      self.txn_ptr = fs.open_txn(self.fs_ptr, txn)
    else:
      self.txn_ptr = None
      if rev is None:
        rev = fs.youngest_rev(self.fs_ptr)
      else:
        rev = int(rev)
    self.rev = rev

    if cmd != None:
      getattr(self, 'cmd_' + cmd)()
开发者ID:lysine,项目名称:wasp,代码行数:26,代码来源:svnlook.py

示例3: __init__

  def __init__(self, pool, path, txn):
    self.pool = pool;
    repos_ptr = repos.open(path, pool)
    self.fs_ptr = repos.fs(repos_ptr)

    self.look = SVNLook(self.pool, path, 'changed', None, txn)

    # Get the list of files and directories which have been added.
    changed = self.look.cmd_changed()
    if debug:
      for item in changed.added + changed.addeddir:
        print >> sys.stderr, 'Adding: ' + item.encode('utf-8')
    if self.numadded(changed) != 0:
      # Find the part of the file tree which they live in.
      changedroot = self.findroot(changed)
      if debug:
        print >> sys.stderr, 'Changedroot is ' + changedroot.encode('utf-8')
      # Get that part of the file tree.
      tree = self.look.cmd_tree(changedroot)
  
      if debug:
        print >> sys.stderr, 'File tree:'
        for path in tree.paths.keys():
          print >> sys.stderr, '  [%d] %s len %d' % (tree.paths[path], path.encode('utf-8'), len(path))
  
      # If a member of the paths hash has a count of more than one there is a
      # case conflict.
      for path in tree.paths.keys():
        if tree.paths[path] > 1:
          # Find out if this is one of the files being added, if not ignore it.
          addedfile = self.showfile(path, changedroot, changed)
          if addedfile <> '':
            print >> sys.stderr, "Case conflict: " + addedfile.encode('utf-8') \
                + "\nA file with same filename but different cases already exist!"
            globals()["exitstat"] = 1
开发者ID:gotgit,项目名称:doc-svn_hooks,代码行数:35,代码来源:check-case-insensitive.py

示例4: setUp

 def setUp(self):
   """Load a Subversion repository"""
   self.temper = utils.Temper()
   (self.repos, _, _) = self.temper.alloc_known_repo(
     'trac/versioncontrol/tests/svnrepos.dump', suffix='-repository')
   self.fs = repos.fs(self.repos)
   self.rev = fs.youngest_rev(self.fs)
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:7,代码来源:repository.py

示例5: putfile

def putfile(fname, rpath, uname="", commitmsg=""):
  rpath = core.svn_path_canonicalize(rpath)
  repos_ptr = repos.open(rpath)
  fsob = repos.fs(repos_ptr)

  # open a transaction against HEAD
  rev = fs.youngest_rev(fsob)

  txn = repos.fs_begin_txn_for_commit(repos_ptr, rev, uname, commitmsg)

  root = fs.txn_root(txn)
  rev_root = fs.revision_root(fsob, rev)

  kind = fs.check_path(root, fname)
  if kind == core.svn_node_none:
    print("file '%s' does not exist, creating..." % fname)
    fs.make_file(root, fname)
  elif kind == core.svn_node_dir:
    print("File '%s' is a dir." % fname)
    return
  else:
    print("Updating file '%s'" % fname)

  handler, baton = fs.apply_textdelta(root, fname, None, None)

  ### it would be nice to get an svn_stream_t. for now, just load in the
  ### whole file and shove it into the FS.
  delta.svn_txdelta_send_string(open(fname, 'rb').read(),
                                handler, baton)

  newrev = repos.fs_commit_txn(repos_ptr, txn)
  print("revision: %s" % newrev)
开发者ID:aosm,项目名称:subversion,代码行数:32,代码来源:putfile.py

示例6: create_file

 def create_file(self, file_name, content, author, comment):
     """
     Creates a file in the SVN repository with the given
     name and content (text). Returns the committed revision
     """
     assert self.svn_repos is not None, "SVN repository not set..."
     # Get an SVN file system pointer
     fs_ptr = repos.fs(self.svn_repos)
     rev = fs.youngest_rev(fs_ptr)
     # Create and SVN transaction
     txn = fs.begin_txn(fs_ptr, rev)
     txn_root = fs.txn_root(txn)
     # Create a file in the root transaction
     fs.make_file(txn_root, file_name)
     stream = fs.apply_text(txn_root, file_name, None)
     core.svn_stream_write(stream, "%s\n" % content)
     core.svn_stream_close(stream)
     # Now set the properties svn:log and svn:author to
     # the newly created node (file)
     fs.change_txn_prop(txn, 'svn:author', author)
     fs.change_txn_prop(txn, 'svn:log', comment)
     # Commit the transaction
     fs.commit_txn(txn)
     # Add teh file to the list of created files
     self.files.append(file_name)
     # Returns therevision number
     return rev + 1
开发者ID:djangsters,项目名称:agilo,代码行数:27,代码来源:test_env_helper.py

示例7: load

    def load(self, repo_path):
	repo_path = core.svn_path_canonicalize(repo_path)
	repos_ptr = repos.open(repo_path)
	fs_ptr = repos.fs(repos_ptr)
	rev = fs.youngest_rev(fs_ptr)
	base_root = fs.revision_root(fs_ptr, 0)
	root = fs.revision_root(fs_ptr, rev)
	hist = fs.node_history(root, self.root)
	while hist is not None:
	    hist = fs.history_prev(hist,0)
	    dummy,rev = fs.history_location(hist)
	    d = fs.revision_prop(fs_ptr, rev, core.SVN_PROP_REVISION_DATE)
	    author = fs.revision_prop(fs_ptr, rev, \
		    core.SVN_PROP_REVISION_AUTHOR)
	    if author == 'svnadmin':
		continue
	    self.last_author = author
	    self.last_date = core.svn_time_from_cstring(d) / 1000000
	    self.last_rev = rev
	    def authz_cb(root, path, pool):
		return 1
	    editor = SvnDumperEditor(self)
	    e_ptr, e_baton = delta.make_editor(editor)
	    repos.dir_delta(base_root, '', '', root, self.root, e_ptr, e_baton,
		authz_cb, 0, 1, 0, 0)
	    break
开发者ID:juanfra684,项目名称:cvs2gitdump,代码行数:26,代码来源:cvs2svndump.py

示例8: blame

def blame(path, filename, rev=None):

  annotresult = {}
  path = core.svn_path_canonicalize(path)

  repos_ptr = repos.open(path)
  fsob = repos.fs(repos_ptr)

  if rev is None:
    rev = fs.youngest_rev(fsob)
  filedata = ''
  for i in range(0, rev+1):
    root = fs.revision_root(fsob, i)
    if fs.check_path(root, filename) != core.svn_node_none:
      first = i
      break
  print("First revision is %d" % first)
  print("Last revision is %d" % rev)
  for i in range(first, rev+1):
    previousroot = root
    root = fs.revision_root(fsob, i)
    if i != first:
      if not fs.contents_changed(root, filename, previousroot, filename):
        continue

    file = fs.file_contents(root, filename)
    previousdata = filedata
    filedata = ''
    while True:
      data = core.svn_stream_read(file, CHUNK_SIZE)
      if not data:
        break
      filedata = filedata + data

    print("Current revision is %d" % i)
    diffresult = difflib.ndiff(previousdata.splitlines(1),
                               filedata.splitlines(1))
    #    print ''.join(diffresult)
    k = 0
    for j in diffresult:
      if j[0] == ' ':
        if k in annotresult:
          k = k + 1
          continue
        else:
          annotresult[k] = (i, j[2:])
          k = k + 1
          continue
      elif j[0] == '?':
        continue
      annotresult[k] = (i, j[2:])
      if j[0] != '-':
        k = k + 1
#    print ''.join(diffresult)
#  print annotresult
  for x in range(len(annotresult.keys())):
     sys.stdout.write("Line %d (r%d):%s" % (x,
                                            annotresult[x][0],
                                            annotresult[x][1]))
开发者ID:Ranga123,项目名称:test1,代码行数:59,代码来源:blame.py

示例9: duplicate_ephemeral_txnprops

def duplicate_ephemeral_txnprops(repos_path, txn_name):
  fs_ptr = repos.fs(repos.open(repos_path))
  txn_t = fs.open_txn(fs_ptr, txn_name)
  for name, value in fs.txn_proplist(txn_t).items():
    if name.startswith(core.SVN_PROP_TXN_PREFIX):
      name = core.SVN_PROP_REVISION_PREFIX + \
                  name[len(core.SVN_PROP_TXN_PREFIX):]
      fs.change_txn_prop(txn_t, name, value)
开发者ID:lysine,项目名称:wasp,代码行数:8,代码来源:persist-ephemeral-txnprops.py

示例10: get_node_id

def get_node_id(pool, repos_path, path, revision):
    # Open the repository and filesystem.
    repos_ptr = repos.open(repos_path, pool)
    fs_ptr = repos.fs(repos_ptr)

    # Fetch the node revision ID of interest
    rev_root = fs.revision_root(fs_ptr, int(revision), pool)
    return fs.unparse_id(fs.node_id(rev_root, path, pool), pool)
开发者ID:jmckaskill,项目名称:subversion,代码行数:8,代码来源:svn-obliterate.py

示例11: connect

 def connect(self, repository):
     """
     Connect with repository
     
     @todo: Create validation for repository url
     """    
     
     # Open repository connection
     self.repository = repos.open(repository)
     self.fs_ptr = repos.fs(self.repository)
开发者ID:michael87,项目名称:Python-CI,代码行数:10,代码来源:subversion.py

示例12: setUp

 def setUp(self):
   """Load the mergeinfo-full Subversion repository.  This dumpfile is
      created by dumping the repository generated for command line log
      tests 16.  If it needs to be updated (mergeinfo format changes, for
      example), we can go there to get a new version."""
   self.temper = utils.Temper()
   (self.repos, _, _) = self.temper.alloc_known_repo('data/mergeinfo.dump',
                                                     suffix='-mergeinfo')
   self.fs = repos.fs(self.repos)
   self.rev = fs.youngest_rev(self.fs)
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:10,代码来源:mergeinfo.py

示例13: check_po

def check_po(pool, repos_path, txn):
    def authz_cb(root, path, pool):
        return 1

    fs_ptr = repos.fs(repos.open(repos_path, pool))
    txn_ptr = fs.open_txn(fs_ptr, txn, pool)
    txn_root = fs.txn_root(txn_ptr, pool)
    base_root = fs.revision_root(fs_ptr, fs.txn_base_revision(txn_ptr), pool)
    editor = ChangeReceiver(txn_root, base_root, pool)
    e_ptr, e_baton = delta.make_editor(editor, pool)
    repos.dir_delta(base_root, "", "", txn_root, "", e_ptr, e_baton, authz_cb, 0, 1, 0, 0, pool)
开发者ID:gotgit,项目名称:doc-svn_hooks,代码行数:11,代码来源:verify-po.py

示例14: dumpprops

def dumpprops(path, filename='', rev=None):
  path = core.svn_path_canonicalize(path)
  repos_ptr = repos.open(path)
  fsob = repos.fs(repos_ptr)

  if rev is None:
    rev = fs.youngest_rev(fsob)

  root = fs.revision_root(fsob, rev)
  print_props(root, filename)
  if fs.is_dir(root, filename):
    walk_tree(root, filename)
开发者ID:vocho,项目名称:openqnx,代码行数:12,代码来源:dumpprops.py

示例15: __init__

 def __init__(self, path):
   """initialize an SVNShell object"""
   Cmd.__init__(self)
   path = core.svn_path_canonicalize(path)
   self.fs_ptr = repos.fs(repos.open(path))
   self.is_rev = 1
   self.rev = fs.youngest_rev(self.fs_ptr)
   self.txn = None
   self.root = fs.revision_root(self.fs_ptr, self.rev)
   self.path = "/"
   self._setup_prompt()
   self.cmdloop()
开发者ID:lysine,项目名称:wasp,代码行数:12,代码来源:svnshell.py


注:本文中的svn.repos.fs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。