Source

repoman / tests / output / pullbranchesspec.py

Full commit
# test .repo/branches concept

import os

from repoman import util

from tests.pytest import run, Quiet

with Quiet() as _:
    run('clone ../forest1 -M * -b * -d pullbranchesspec1')
    run('clone pullbranchesspec1 -M * -b core/dev -d pullbranchesspec2')

def do(n, s):
    return run('-R pullbranchesspec%d %s' % (n, s))

def run1(s):
    return do(1, s)

def run2(s):
    return do(2, s)

def use_modules(m):
    util.write_utf8(os.path.join('pullbranchesspec2', '.repo', 'branches'), '\r\n'.join(m))

def write_and_commit(s):
    with open(os.path.join('pullbranchesspec1', 'a', 'foo'), 'ab') as fh:
        fh.write(s)
    os.system('hg -R pullbranchesspec1/a ci -m foo -d "0 0"')

run1('up core/dev')
run1('branch --create core/foo -d "0 0"')
write_and_commit('foo\r\n')
run1('up core/dev')
write_and_commit('baz\r\n')
run1('up core/stable')
write_and_commit('bar\r\n')

run2('info')
run2('-M a incoming')

use_modules(['.'])
run2('info')
run2('-M a incoming')

use_modules(['*'])
run2('info')
run2('-M a incoming')

use_modules(['core/stable', 'core/foo'])
run2('info')
run2('-M a incoming')
run2('-M a incoming -b core/foo')