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


Python fs.youngest_rev函数代码示例

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


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

示例1: __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

示例2: test_get_log2

    def test_get_log2(self):
        # Get an interesting commmit.
        self.test_commit3()
        rev = fs.youngest_rev(self.fs)
        revprops = ra.rev_proplist(self.ra_ctx, rev)
        self.assert_("svn:log" in revprops)
        self.assert_("testprop" in revprops)

        def receiver(log_entry, pool):
            called[0] = True
            self.assertEqual(log_entry.revision, rev)
            if discover_changed_paths:
                self.assertEqual(list(log_entry.changed_paths.keys()), ["/bla3"])
                changed_path = log_entry.changed_paths["/bla3"]
                self.assert_(changed_path.action in ["A", "D", "R", "M"])
                self.assertEqual(changed_path.copyfrom_path, None)
                self.assertEqual(changed_path.copyfrom_rev, -1)
            else:
                self.assertEqual(log_entry.changed_paths, None)
            if log_revprops is None:
                self.assertEqual(log_entry.revprops, revprops)
            elif len(log_revprops) == 0:
                self.assert_(log_entry.revprops == None or len(log_entry.revprops) == 0)
            else:
                revprop_names = sorted(log_entry.revprops.keys())
                log_revprops.sort()
                self.assertEqual(revprop_names, log_revprops)
                for i in log_revprops:
                    self.assertEqual(
                        log_entry.revprops[i],
                        revprops[i],
                        msg="%s != %s on %s"
                        % (log_entry.revprops[i], revprops[i], (log_revprops, discover_changed_paths)),
                    )

        for log_revprops in (
            # Retrieve the standard three.
            ["svn:author", "svn:date", "svn:log"],
            # Retrieve just testprop.
            ["testprop"],
            # Retrieve all.
            None,
            # Retrieve none.
            [],
        ):
            for discover_changed_paths in [True, False]:
                called = [False]
                ra.get_log2(
                    self.ra_ctx,
                    [""],
                    rev,
                    rev,  # start, end
                    1,  # limit
                    discover_changed_paths,
                    True,  # strict_node_history
                    False,  # include_merged_revisions
                    log_revprops,
                    receiver,
                )
                self.assert_(called[0])
开发者ID:Ranga123,项目名称:test1,代码行数:60,代码来源:ra.py

示例3: test_do_diff2

  def test_do_diff2(self):

    class ChangeReceiver(delta.Editor):
        def __init__(self):
            self.textdeltas = []

        def apply_textdelta(self, file_baton, base_checksum):
            def textdelta_handler(textdelta):
                if textdelta is not None:
                    self.textdeltas.append(textdelta)
            return textdelta_handler

    editor = ChangeReceiver()

    e_ptr, e_baton = delta.make_editor(editor)

    fs_revnum = fs.youngest_rev(self.fs)

    sess_url = ra.get_session_url(self.ra_ctx)
    try:
        ra.reparent(self.ra_ctx, REPOS_URL+"/trunk")
        reporter, reporter_baton = ra.do_diff2(self.ra_ctx, fs_revnum,
                                               "README.txt", 0, 0, 1,
                                               REPOS_URL+"/trunk/README.txt",
                                               e_ptr, e_baton)
        reporter.set_path(reporter_baton, "", 0, True, None)
        reporter.finish_report(reporter_baton)
    finally:
        ra.reparent(self.ra_ctx, sess_url)
      
    self.assertEqual("A test.\n", editor.textdeltas[0].new_data)
    self.assertEqual(1, len(editor.textdeltas))
开发者ID:vocho,项目名称:openqnx,代码行数:32,代码来源:ra.py

示例4: __init__

    def __init__(self, path, authz):
        Repository.__init__(self, authz)

        if core.SVN_VER_MAJOR < 1:
            raise TracError, \
                  "Subversion >= 1.0 required: Found %d.%d.%d" % \
                  (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)

        self.repos = None
        self.fs_ptr = None
        self.path = path

        # Remove any trailing slash or else subversion might abort
        if not os.path.split(path)[1]:
            path = os.path.split(path)[0]
        self.path = repos.svn_repos_find_root_path(path)
        if self.path is None:
            raise TracError, "%s does not appear to be a Subversion repository." % (path, )
        if self.path != path:
            self.scope = path[len(self.path):]
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'

        self.repos = repos.svn_repos_open(self.path)
        self.fs_ptr = repos.svn_repos_fs(self.repos)
        self.rev = fs.youngest_rev(self.fs_ptr)

        self.history = None
        if self.scope != '/':
            self.history = []
            for path,rev in _get_history(self.scope[1:], self.authz,
                                         self.fs_ptr, 0, self.rev):
                self.history.append(rev)
开发者ID:vocho,项目名称:openqnx,代码行数:35,代码来源:svn_fs.py

示例5: get_youngest_rev

 def get_youngest_rev(self):
     if not self.youngest:
         self.youngest = fs.youngest_rev(self.fs_ptr, self.pool())
         if self.scope != '/':
             for path, rev in self._history('', 0, self.youngest, limit=1):
                 self.youngest = rev
     return self.youngest
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:7,代码来源:svn_fs.py

示例6: open

  def open(self):
    # 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):
      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

    # Open the repository and init some other variables.
    self.repos = repos.svn_repos_open(self.rootpath)
    self.fs_ptr = repos.svn_repos_fs(self.repos)
    self.youngest = fs.youngest_rev(self.fs_ptr)
    self._fsroots = {}
    self._revinfo_cache = {}

    # See if a universal read access determination can be made.
    if self.auth and self.auth.check_universal_access(self.name) == 1:
      self.auth = None
开发者ID:manuvaldi,项目名称:viewvc-wiki,代码行数:27,代码来源:svn_repos.py

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: get_youngest_rev

 def get_youngest_rev(self):
     if not self.youngest:
         self.youngest = fs.youngest_rev(self.fs_ptr, self.pool())
         if self.scope != "/":
             for path, rev in self._history("", 1, self.youngest, self.pool):
                 self.youngest = rev
                 break
     return self.youngest
开发者ID:gdgkyoto,项目名称:kyoto-gtug,代码行数:8,代码来源:svn_fs.py

示例14: _revisionSetup

 def _revisionSetup(self, subpool, author, message):
     """ All of the setup for performing a revision. """
     revision = fs.youngest_rev(self.fsob, subpool)
     transaction = repos.svn_repos_fs_begin_txn_for_commit(self.repos_ptr,
                                                           revision, 
                                                           author, message,
                                                           subpool)
     root = fs.txn_root(transaction, subpool)
     return (revision, transaction, root)
开发者ID:tgreaves,项目名称:sccs2svn,代码行数:9,代码来源:sccs2svn.py

示例15: get_actual_version

 def get_actual_version(self):
     """
     Get the actual version of the repostory
     
     @return: youngest_rev
     """
     
     # Return youngest revision
     return fs.youngest_rev(self.fs_ptr)
开发者ID:michael87,项目名称:Python-CI,代码行数:9,代码来源:subversion.py


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