Beispiel #1
0
def command(args):
    import sys

    from sr.tools.trac import Ticket, TracProxy, WrongServer

    try:
        server = TracProxy()
    except WrongServer:
        print("Error: The specified server is not a Trac instance",
              file=sys.stderr)
        sys.exit(1)

    t = Ticket(args.ticket, server)

    for n in args.deps:
        t.deps.remove(n)

    if args.m is not None:
        msg = args.m
        msg += "\n\n"
    else:
        msg = ""

    msg += "Removing dependencies:"
    for n in args.deps:
        msg += "\n * #{0}".format(n)

    updated = t.cleanup(dry_run=args.dry_run, msg=msg)

    if updated:
        if args.dry_run:
            print("Ticket would have been updated if not for --dry-run.")
        else:
            print("Ticket updated.")
Beispiel #2
0
def command(args):
    import sys

    from sr.tools.trac import Ticket, TracProxy, WrongServer

    try:
        server = TracProxy()
    except WrongServer:
        print("Error: The specified server is not a Trac instance",
              file=sys.stderr)
        sys.exit(1)

    t = Ticket(args.ticket, server)

    for n in args.deps:
        t.deps.remove(n)

    if args.m is not None:
        msg = args.m
        msg += "\n\n"
    else:
        msg = ""

    msg += "Removing dependencies:"
    for n in args.deps:
        msg += "\n * #{0}".format(n)

    updated = t.cleanup(dry_run=args.dry_run, msg=msg)

    if updated:
        if args.dry_run:
            print("Ticket would have been updated if not for --dry-run.")
        else:
            print("Ticket updated.")
Beispiel #3
0
def command(args):
    import sys

    from sr.tools.trac import Ticket, TracProxy, WrongServer

    try:
        server = TracProxy()
    except WrongServer:
        print("Error: The specified server is not a Trac instance",
              file=sys.stderr)
        sys.exit(1)

    t = Ticket(args.ticket, server)

    current = set(t.deps)
    new = set(args.deps)

    to_add = new - current
    already = new - to_add

    if len(already):
        for n in already:
            print('#{0} is already a dep of #{1}'.format(n, args.ticket),
                  file=sys.stderr)

    if len(to_add) == 0:
        sys.exit("No new dependencies to add to #{0}".format(args.ticket))

    t.deps += to_add

    if args.m is not None:
        msg = args.m
        msg += "\n\n"
    else:
        msg = ""

    msg += "Adding dependencies:"
    for n in to_add:
        msg += "\n * #{0}".format(n)

    updated = t.cleanup(dry_run=args.dry_run, msg=msg)

    if updated:
        if args.dry_run:
            print("Ticket would have been updated if not for --dry-run.")
        else:
            print("Ticket updated.")
Beispiel #4
0
def command(args):
    import sys

    from sr.tools.trac import Ticket, TracProxy, WrongServer

    try:
        server = TracProxy()
    except WrongServer:
        print("Error: The specified server is not a Trac instance",
              file=sys.stderr)
        sys.exit(1)

    t = Ticket(args.ticket, server)

    current = set(t.deps)
    new = set(args.deps)

    to_add = new - current
    already = new - to_add

    if len(already):
        for n in already:
            print('#{0} is already a dep of #{1}'.format(n, args.ticket),
                  file=sys.stderr)

    if len(to_add) == 0:
        sys.exit("No new dependencies to add to #{0}".format(args.ticket))

    t.deps += to_add

    if args.m is not None:
        msg = args.m
        msg += "\n\n"
    else:
        msg = ""

    msg += "Adding dependencies:"
    for n in to_add:
        msg += "\n * #{0}".format(n)

    updated = t.cleanup(dry_run=args.dry_run, msg=msg)

    if updated:
        if args.dry_run:
            print("Ticket would have been updated if not for --dry-run.")
        else:
            print("Ticket updated.")