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


Python revisionspec.RevisionSpec类代码示例

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


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

示例1: test_branch_status_revisions

    def test_branch_status_revisions(self):
        """Tests branch status with revisions"""
        wt = self.make_branch_and_tree('.')

        self.build_tree(['hello.c', 'bye.c'])
        wt.add('hello.c')
        wt.add('bye.c')
        wt.commit('Test message')

        revs = [RevisionSpec.from_string('0')]
        self.assertStatus([
                'added:\n',
                '  bye.c\n',
                '  hello.c\n'
            ],
            wt,
            revision=revs)

        self.build_tree(['more.c'])
        wt.add('more.c')
        wt.commit('Another test message')

        revs.append(RevisionSpec.from_string('1'))
        self.assertStatus([
                'added:\n',
                '  bye.c\n',
                '  hello.c\n',
            ],
            wt,
            revision=revs)
开发者ID:Distrotech,项目名称:bzr,代码行数:30,代码来源:test_status.py

示例2: test_tree_statusxml_specific_files

    def test_tree_statusxml_specific_files(self):
        """Tests branch status with given specific files"""
        wt = self.make_branch_and_tree('.')
        b = wt.branch

        self.build_tree(['directory/','directory/hello.c',
            'bye.c','test.c','dir2/'])
        wt.add('directory')
        wt.add('test.c')
        wt.commit('testing')

        xml_status = create_xml(wt, {'unknown':[('file','bye.c', {}),
            ('directory', 'dir2', {}), ('file', 'directory/hello.c', {})]})
        self.assertStatus(xml_status, wt)

        tof = StringIO()
        show_tree_status_xml(wt, specific_files=['bye.c','test.c','absent.c'], to_file=tof)
        log_xml = fromstring(tof.getvalue())
        nonexistents = log_xml.findall('nonexistents/nonexistent')
        unknowns = log_xml.findall('unknown')
        self.assertEquals(1, len(nonexistents))
        self.assertEquals(1, len(unknowns))

        self.assertStatus(create_xml(wt, {'unknown':[('file',
            'directory/hello.c', {})]}), wt, specific_files=['directory'])

        self.assertStatus(create_xml(wt, {'unknown':[('directory',
            'dir2', {})]}), wt, specific_files=['dir2'])

        revs = [RevisionSpec.from_string('0'), RevisionSpec.from_string('1')]
        self.assertStatus(create_xml(wt, {'added':[('file', 'test.c', {})]}),
            wt, revs, specific_files=['test.c'])
开发者ID:lenin,项目名称:bzr-xmloutput,代码行数:32,代码来源:test_status_xml.py

示例3: tests_revision_to_revision

 def tests_revision_to_revision(self):
     """doing a status between two revision trees should work."""
     tree = self.make_branch_and_tree('.')
     r1_id = tree.commit('one', allow_pointless=True)
     r2_id = tree.commit('two', allow_pointless=True)
     r2_tree = tree.branch.repository.revision_tree(r2_id)
     output = StringIO()
     show_tree_status(tree, to_file=output,
                  revision=[RevisionSpec.from_string("revid:%s" % r1_id),
                            RevisionSpec.from_string("revid:%s" % r2_id)])
开发者ID:c0ns0le,项目名称:cygwin,代码行数:10,代码来源:test_status.py

示例4: test_invalid_line

 def test_invalid_line(self):
     spec = RevisionSpec.from_string('annotate:annotate-tree/file1:q')
     e = self.assertRaises(errors.InvalidRevisionSpec,
                           spec.as_revision_id, self.tree.branch)
     self.assertContainsRe(str(e),
         r"Requested revision: \'annotate:annotate-tree/file1:q\' does not"
         " exist in branch: .*\nNo such line: q")
开发者ID:GymWenFLL,项目名称:tpp_libs,代码行数:7,代码来源:test_revisionspec.py

示例5: test_no_such_file_with_colon

 def test_no_such_file_with_colon(self):
     spec = RevisionSpec.from_string('annotate:annotate-tree/fi:le2:1')
     e = self.assertRaises(errors.InvalidRevisionSpec,
                           spec.as_revision_id, self.tree.branch)
     self.assertContainsRe(str(e),
         r"Requested revision: \'annotate:annotate-tree/fi:le2:1\' does not"
         " exist in branch: .*\nFile 'fi:le2' is not versioned")
开发者ID:GymWenFLL,项目名称:tpp_libs,代码行数:7,代码来源:test_revisionspec.py

示例6: test_line_log_single_merge_revision

    def test_line_log_single_merge_revision(self):
        wt = self.make_branch_and_memory_tree('.')
        wt.lock_write()
        try:
            wt.add('')
            wt.commit('rev-1', rev_id='rev-1',
                      timestamp=1132586655, timezone=36000,
                      committer='Joe Foo <[email protected]>')
            wt.commit('rev-merged', rev_id='rev-2a',
                      timestamp=1132586700, timezone=36000,
                      committer='Joe Foo <[email protected]>')
            wt.set_parent_ids(['rev-1', 'rev-2a'])
            wt.branch.set_last_revision_info(1, 'rev-1')
            wt.commit('rev-2', rev_id='rev-2b',
                      timestamp=1132586800, timezone=36000,
                      committer='Joe Foo <[email protected]>')
            logfile = self.make_utf8_encoded_stringio()
            formatter = LineLogFormatter(to_file=logfile)
            revspec = RevisionSpec.from_string('1.1.1')
            wtb = wt.branch
            rev = revspec.in_history(wtb)
            show_log(wtb, formatter, start_revision=rev, end_revision=rev)
            self.assertEqualDiff(logfile.getvalue(), """\
1.1.1: Joe Foo 2005-11-22 rev-merged
""")
        finally:
            wt.unlock()
开发者ID:c0ns0le,项目名称:cygwin,代码行数:27,代码来源:test_log.py

示例7: test_merges_nonsupporting_formatter

 def test_merges_nonsupporting_formatter(self):
     """Tests that show_log will raise if the formatter doesn't
     support merge revisions."""
     wt = self.make_branch_and_memory_tree('.')
     wt.lock_write()
     try:
         wt.add('')
         wt.commit('rev-1', rev_id='rev-1',
                   timestamp=1132586655, timezone=36000,
                   committer='Joe Foo <[email protected]>')
         wt.commit('rev-merged', rev_id='rev-2a',
                   timestamp=1132586700, timezone=36000,
                   committer='Joe Foo <[email protected]>')
         wt.set_parent_ids(['rev-1', 'rev-2a'])
         wt.branch.set_last_revision_info(1, 'rev-1')
         wt.commit('rev-2', rev_id='rev-2b',
                   timestamp=1132586800, timezone=36000,
                   committer='Joe Foo <[email protected]>')
         logfile = self.make_utf8_encoded_stringio()
         formatter = ShortLogFormatter(to_file=logfile)
         wtb = wt.branch
         lf = LogCatcher()
         revspec = RevisionSpec.from_string('1.1.1')
         rev = revspec.in_history(wtb)
         self.assertRaises(BzrCommandError, show_log, wtb, lf,
                           start_revision=rev, end_revision=rev)
     finally:
         wt.unlock()
开发者ID:c0ns0le,项目名称:cygwin,代码行数:28,代码来源:test_log.py

示例8: test_as_revision_id_uncommitted

 def test_as_revision_id_uncommitted(self):
     spec = RevisionSpec.from_string('annotate:annotate-tree/file1:3')
     e = self.assertRaises(errors.InvalidRevisionSpec,
                           spec.as_revision_id, self.tree.branch)
     self.assertContainsRe(str(e),
         r"Requested revision: \'annotate:annotate-tree/file1:3\' does not"
         " exist in branch: .*\nLine 3 has not been committed.")
开发者ID:GymWenFLL,项目名称:tpp_libs,代码行数:7,代码来源:test_revisionspec.py

示例9: log

    def log(self, uri, rev=None):
        """
        Return the changelog of data stored at or under @param:uri
        as of time @param:rev in JSON-listing format.
        
        @raise:ResourceUnchanged
        etc.
        """

        from bzrlib.log import LogFormatter

        def get_formatter(lst):
            class ListLogFormatter(LogFormatter):
                def __init__(self, *args, **kw):
                    LogFormatter.__init__(self, *args, **kw)
                    self._loglist = lst
                def log_revision(self, revision):
                    revno = int(revision.revno)
                    author = revision.rev.committer  # @@@ what about get_apparent_authors?
                    message = revision.rev.message.rstrip('\r\n')
                    timestamp = revision.rev.timestamp
                    self._loglist.append(dict(version=revno,
                                              author=author,
                                              message=message,
                                              timestamp=timestamp,
                                              id=uri,
                                              revprops=revision.rev.properties))
            return ListLogFormatter

        from bzrlib.builtins import cmd_log
        from bzrlib.revisionspec import RevisionSpec

        log = cmd_log()
        log.outf = None

        foo = []

        absolute_uri = os.path.join(self.checkout_dir, self.normalized(uri))

        log.run(file_list=[absolute_uri],
                revision=rev and [RevisionSpec.from_string("1"),
                                  RevisionSpec.from_string(str(rev))] or None,
                log_format = get_formatter(foo),
                )

        return [dict(href=uri, fields=i) for i in foo]
开发者ID:ejucovy,项目名称:sven,代码行数:46,代码来源:bzr.py

示例10: get_file_content

 def get_file_content(self, filename, revision):
   rev_spec = RevisionSpec.from_string(revision)
   tree = rev_spec.as_tree(self.branch)
   file_id = tree.path2id(unicode(filename, 'utf8'))
   if file_id == None:
     return None
   content = tree.get_file_text(file_id)
   return content
开发者ID:Alwahsh,项目名称:ohloh_scm,代码行数:8,代码来源:bzrlib_pipe_server.py

示例11: g_revid

def g_revid(repo, rev):
    try:
        if isinstance(rev, int) or isinstance(rev, long):
            return repo.branch.get_rev_id(rev)
        else:
            return RevisionSpec.from_string(rev).in_history(repo.branch).rev_id
    except (NoSuchRevision, InvalidRevisionSpec):
        vim_throw('norev', rev, repo.basedir)
开发者ID:skeept,项目名称:dotvim,代码行数:8,代码来源:aubazaar.py

示例12: getheads

 def getheads(self):
     if not self.rev:
         return [self.branch.last_revision()]
     try:
         r = RevisionSpec.from_string(self.rev)
         info = r.in_history(self.branch)
     except errors.BzrError:
         raise util.Abort(_('%s is not a valid revision in current branch')
                          % self.rev)
     return [info.rev_id]
开发者ID:agbiotec,项目名称:galaxy-tools-vcr,代码行数:10,代码来源:bzr.py

示例13: test_as_revision_id

 def test_as_revision_id(self):
     self.assertAsRevisionId('r1', 'mainline:1')
     self.assertAsRevisionId('r2', 'mainline:1.1.1')
     self.assertAsRevisionId('r2', 'mainline:revid:alt_r2')
     spec = RevisionSpec.from_string('mainline:revid:alt_r22')
     e = self.assertRaises(errors.InvalidRevisionSpec,
                           spec.as_revision_id, self.tree.branch)
     self.assertContainsRe(str(e),
         "Requested revision: 'mainline:revid:alt_r22' does not exist in"
         " branch: ")
开发者ID:GymWenFLL,项目名称:tpp_libs,代码行数:10,代码来源:test_revisionspec.py

示例14: get_revision_id

def get_revision_id(revision, from_branch, tip=False):
    """Return revision id for a revision number and a branch.

    If the revision is empty, the revision_id will be None.

    If ``tip`` is True, the revision value will be ignored.
    """
    if not tip and revision:
        spec = RevisionSpec.from_string(revision)
        return spec.as_revision_id(from_branch)
开发者ID:abramhindle,项目名称:UnnaturalCodeFork,代码行数:10,代码来源:sourcecode.py

示例15: test_branch_statusxml_revisions

    def test_branch_statusxml_revisions(self):
        """Tests branch status with revisions"""
        wt = self.make_branch_and_tree('.')

        self.build_tree(['hello.c', 'bye.c'])
        wt.add('hello.c')
        wt.add('bye.c')
        wt.commit('Test message')

        revs = [RevisionSpec.from_string('0')]
        two_added = create_xml(wt, {'added':[('file', 'bye.c', {}),
            ('file', 'hello.c', {})]})
        self.assertStatus(two_added, wt, revision=revs)

        self.build_tree(['more.c'])
        wt.add('more.c')
        wt.commit('Another test message')

        revs.append(RevisionSpec.from_string('1'))
        self.assertStatus(two_added, wt, revision=revs)
开发者ID:lenin,项目名称:bzr-xmloutput,代码行数:20,代码来源:test_status_xml.py


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