1. Henrik Stuart
  2. repoman

Source

repoman / tests / output / paths.py

import sys
import os
import shutil

from repoman.ui import SimpleUi as ui
from repoman import forest

from tests.runtests import run_command
from tests.pytest import run, Quiet

with Quiet():
    run('clone ../forest1 -M * -b * -d paths')
os.chdir('paths')
try:
    # Check that paths (without arguments) produces list of current aliases
    run('paths')
    # Check that paths (with arguments) updates and produces list of aliases
    # and skips removals of absent aliases
    run('paths --add default=foobar --remove clone --remove absent')
    # Check that paths updates are committed
    ret, output = run_command('hg log -R .repo -r tip --template "log: {desc}\\n"')
    sys.stdout.write(output)
    # Check that addition and removal of the same alias is flagged as an error
    run('paths --add default=foobar --remove default')
finally:
    os.chdir('..')

try:
    shutil.rmtree('paths')
except:
    pass