コード例 #1
0
def update_minor_ver_in_trunk(ver):
    """Change the minor version in trunk to the next (future) minor version.
    """
    trunk_wc = get_trunk_wc_path()
    trunk_url = get_trunk_url()
    svn_checkout(trunk_url, trunk_wc)

    prev_ver = Version('1.%d.0' % (ver.minor - 1, ))
    next_ver = Version('1.%d.0' % (ver.minor + 1, ))
    relpaths = []

    relpath = 'subversion/include/svn_version.h'
    relpaths.append(relpath)
    edit_file(get_trunk_wc_path(relpath),
              r'(#define SVN_VER_MINOR *)%s' % (ver.minor, ),
              r'\g<1>%s' % (next_ver.minor, ))

    relpath = 'subversion/tests/cmdline/svntest/main.py'
    relpaths.append(relpath)
    edit_file(get_trunk_wc_path(relpath),
              r'(SVN_VER_MINOR = )%s' % (ver.minor, ),
              r'\g<1>%s' % (next_ver.minor, ))

    relpath = 'subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java'
    relpaths.append(relpath)
    try:
        # since r1817921 (just after branching 1.10)
        edit_file(get_trunk_wc_path(relpath),
                  r'SVN_VER_MINOR = %s;' % (ver.minor, ),
                  r'SVN_VER_MINOR = %s;' % (next_ver.minor, ))
    except:
        # before r1817921: two separate places
        edit_file(get_trunk_wc_path(relpath),
                  r'version.isAtLeast\(1, %s, 0\)' % (ver.minor, ),
                  r'version.isAtLeast\(1, %s, 0\)' % (next_ver.minor, ))
        edit_file(get_trunk_wc_path(relpath), r'1.%s.0, but' % (ver.minor, ),
                  r'1.%s.0, but' % (next_ver.minor, ))

    relpath = 'CHANGES'
    relpaths.append(relpath)
    # insert at beginning of CHANGES file
    prepend_file(
        get_trunk_wc_path(relpath),
        'Version ' + next_ver.base + '\n' + '(?? ??? 20XX, from /branches/' +
        next_ver.branch + '.x)\n' + get_tag_url(next_ver) + '\n' + '\n')

    log_msg = '''\
Increment the trunk version number to %s, and introduce a new CHANGES
section, following the creation of the %s.x release branch.

* subversion/include/svn_version.h,
  subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java,
  subversion/tests/cmdline/svntest/main.py
    (SVN_VER_MINOR): Increment to %s.

* CHANGES: New section for %s.0.
''' % (next_ver.branch, ver.branch, next_ver.minor, next_ver.branch)
    commit_paths = [get_trunk_wc_path(p) for p in relpaths]
    svn_commit(commit_paths + ['-m', log_msg])
コード例 #2
0
def test_from_string(string: str, numbers: Tuple):
    if not numbers:
        with pytest.raises(ValueError):
            _ = Version.from_string(string)
    else:
        version = Version.from_string(string)
        assert version.tuple == numbers
        assert Version(*numbers) == version
コード例 #3
0
def steps(args):
    ver = Version('1.10.0')

    make_release_branch(ver)
    update_minor_ver_in_trunk(ver)
    create_status_file_on_branch(ver)
    update_backport_bot(ver)
    update_buildbot_config(ver)
コード例 #4
0
def update_buildbot_config(ver):
    """Add the new branch to the list of branches monitored by the buildbot
       master.
    """
    buildbot_wc = get_buildbot_wc_path()
    buildbot_url = get_buildbot_url()
    svn_checkout(buildbot_url, buildbot_wc)

    prev_ver = Version('1.%d.0' % (ver.minor - 1, ))
    next_ver = Version('1.%d.0' % (ver.minor + 1, ))

    relpath = 'master1/projects/subversion.conf'
    edit_file(get_buildbot_wc_path(relpath),
              r'(MINOR_LINES=\[.*%s)(\])' % (prev_ver.minor, ),
              r'\1, %s\2' % (ver.minor, ))

    log_msg = '''\
Subversion: start monitoring the %s branch.
''' % (ver.branch)
    commit_paths = [get_buildbot_wc_path(relpath)]
    svn_commit(commit_paths + ['-m', log_msg])
コード例 #5
0
def test_creation_errors(inputs: Tuple):
    with pytest.raises(ValueError):
        _ = Version(*inputs)
コード例 #6
0
def test_increments(inputs: Tuple, outputs: Tuple):
    version = Version(*inputs)
    version.increment_major()
    assert version.tuple == outputs[0]

    version = Version(*inputs)
    version.increment_minor()
    assert version.tuple == outputs[1]

    version = Version(*inputs)
    version.increment_patch()
    assert version.tuple == outputs[2]
コード例 #7
0
def test_tag(string: str):
    assert Version.from_string(string).tag == 'v' + string
コード例 #8
0
def test_string_round_trip(string: str):
    assert str(Version.from_string(string)) == string