示例#1
0
文件: save.py 项目: bobbyrward/equity
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
示例#2
0
文件: list.py 项目: bobbyrward/equity
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
示例#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
示例#4
0
文件: show.py 项目: bobbyrward/equity
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