diff options
author | Florian Zschocke <2362065+flaix@users.noreply.github.com> | 2022-10-22 12:51:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 12:51:51 +0200 |
commit | 32b1e66805f4e924f5fb72de61f99941967ab125 (patch) | |
tree | d66cb7d99314b06a3b6fd15dee160436da6de824 /src/main/java | |
parent | 3c54c9f73678d86cf34edf6d0ef3a727ca8286c0 (diff) | |
parent | cdfae5b5dde7f257fa8c2ea48e023f6311165713 (diff) | |
download | gitblit-32b1e66805f4e924f5fb72de61f99941967ab125.tar.gz gitblit-32b1e66805f4e924f5fb72de61f99941967ab125.zip |
Merge pull request #1428 from urkle/fix-pt
Correct is/is not usage in pt.py to not be used with the value is a literal
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/pt.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/pt.py b/src/main/java/pt.py index f45baded..f2479d83 100644 --- a/src/main/java/pt.py +++ b/src/main/java/pt.py @@ -88,7 +88,7 @@ def checkout(args): else: branches.append(branch.strip()) - if args.patchset is None or args.patchset is 0: + if args.patchset is None or args.patchset == 0: branch = 'ticket/{:d}'.format(args.id) illegals = set(branches) & {'ticket'} else: @@ -104,7 +104,7 @@ def checkout(args): print(' ' + illegal) exit(errno.EINVAL) - if args.patchset is None or args.patchset is 0: + if args.patchset is None or args.patchset == 0: # checkout the current ticket patchset if args.force: __call(['git', 'checkout', '-B', branch, '{}/{}'.format(args.remote, branch)]) @@ -131,7 +131,7 @@ def pull(args): __call(['git', 'reset', '--hard']) # pull the patchset from the remote repository - if args.patchset is None or args.patchset is 0: + if args.patchset is None or args.patchset == 0: print("Pulling ticket {} from the '{}' repository".format(args.id, args.remote)) patchset_ref = 'ticket/{:d}'.format(args.id) else: @@ -550,11 +550,11 @@ def __checkout(remote, ticket, patchset, branch, force=False): else: # try to merge the existing ref with the FETCH_HEAD merge = __call(['git', 'merge', '--ff-only', branch, 'FETCH_HEAD'], echo=True, fail=False) - if len(merge) is 1: + if len(merge) == 1: up_to_date = merge[0].lower().index('up-to-date') > 0 if up_to_date: return - elif len(merge) is 0: + elif len(merge) == 0: print('') print("Your '{}' branch has diverged from patchset {} on the '{}' repository.".format(branch, patchset, remote)) print('') @@ -617,13 +617,13 @@ def __call(cmd_args, echo=False, fail=True, err=None): lines = [] for line in iter(p.stdout.readline, b''): line_str = str(line).strip() - if len(line_str) is 0: + if len(line_str) == 0: break lines.append(line_str) if echo: print(line_str) p.wait() - if fail and p.returncode is not 0: + if fail and p.returncode != 0: exit(p.returncode) return lines |