| | |
| | | # |
| | | |
| | | __author__ = 'James Moger' |
| | | __version__ = '1.0.5' |
| | | __version__ = '1.0.6' |
| | | |
| | | import subprocess |
| | | import argparse |
| | |
| | | # fetch all current ticket patchsets |
| | | print("Fetching ticket patchsets from the '{}' repository".format(args.remote)) |
| | | if args.quiet: |
| | | __call(['git', 'fetch', args.remote, '--quiet']) |
| | | __call(['git', 'fetch', '-p', args.remote, '--quiet']) |
| | | else: |
| | | __call(['git', 'fetch', args.remote]) |
| | | __call(['git', 'fetch', '-p', args.remote]) |
| | | else: |
| | | # fetch specific patchset |
| | | __resolve_patchset(args) |
| | |
| | | |
| | | print("Pushing your patchset to the '{}' repository".format(args.remote)) |
| | | __call(['git', 'push', args.remote, ref_spec], echo=True) |
| | | |
| | | if args.force and args.patchset is not None and args.patchset is not 0: |
| | | # if we had to force the push then there is a new patchset |
| | | # revision on the server so checkout out the new patchset |
| | | args.patchset = None |
| | | args.force = False |
| | | args.quiet = True |
| | | checkout(args) |
| | | |
| | | return |
| | | |
| | | |
| | |
| | | branches.append(branch.strip()) |
| | | |
| | | branch = 'topic/' + args.topic |
| | | try: |
| | | int(args.topic) |
| | | branch = 'ticket/' + args.topic |
| | | except ValueError: |
| | | pass |
| | | |
| | | illegals = set(branches) & {'topic', branch} |
| | | |
| | | # ensure there are no local branch names that will interfere with branch creation |
| | |
| | | curr_branch = branch[1:].strip() |
| | | if curr_branch.startswith('topic/'): |
| | | topic = curr_branch[6:].strip() |
| | | try: |
| | | int(topic) |
| | | push_ref = topic |
| | | except ValueError: |
| | | pass |
| | | if curr_branch.startswith('ticket/'): |
| | | topic = curr_branch[7:].strip() |
| | | try: |
| | | int(topic) |
| | | push_ref = topic |
| | |
| | | if fields[0] == 'remote' and fields[1].strip().startswith('--> #'): |
| | | # set the upstream branch configuration |
| | | args.id = int(fields[1].strip()[len('--> #'):]) |
| | | __call(['git', 'fetch', args.remote]) |
| | | __call(['git', 'branch', '--set-upstream-to={}/ticket/{:d}'.format(args.remote, args.id)]) |
| | | __call(['git', 'fetch', '-p', args.remote]) |
| | | __call(['git', 'branch', '-u', '{}/ticket/{:d}'.format(args.remote, args.id)]) |
| | | break |
| | | |
| | | return |