Exemplo n.º 1
0
def save_patch(args, options, parser):
    if len(args) != 1:
        raise Exception('A name for the patch must be provided')

    description = args[0]

    stash = Stash()

    svn = SvnController()

    modified_files = svn.status()
    if not modified_files:
        raise Exception('No changes to stash')

    summary = '\n'.join(' -> '.join(x) for x in modified_files)

    patch = svn.diff()

    try:
        stash.add_patch(patch, summary, description)
    except Exception:
        stash.rollback()
        raise
    else:
        stash.commit()
    finally:
        stash.close()

    return 0
Exemplo n.º 2
0
def list_patches(args, options, parser):
    stash = Stash()

    try:
        patches = stash.get_all_patches()
    finally:
        stash.close()

    for patch in patches:
        print patch['id'], patch['date_created'], patch['description']

    return 0
Exemplo n.º 3
0
def save_patch(args, options, parser):
    if len(args) != 1:
        raise Exception("Must provide the patch id or patch description")

    stash = Stash()

    try:
        patch = stash.find_specific_patch(args[0])["patch"]

        apply_patch(zlib.decompress(patch))

        # flag the patch as deleted?

    finally:
        stash.close()

    return 0
Exemplo n.º 4
0
def show_patch_details(args, options, parser):
    if len(args) != 1:
        raise Exception('Must provide the patch id or patch description')

    stash = Stash()

    try:
        patches = stash.find_patches(args[0])
    finally:
        stash.close()

    for patch in patches:
        print patch['id'], patch['date_created'], patch['description']
        print patch['summary']
        print

    return 0