update arguments to be more consistent, allow specifying branch to update from
This commit is contained in:
parent
969e800973
commit
f43c773628
|
@ -18,13 +18,17 @@ def site_update(args):
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
return 1
|
return 1
|
||||||
if 'behind' in str(p.stdout):
|
if 'behind' in str(p.stdout):
|
||||||
|
if args.b:
|
||||||
|
p = subprocess.run(['git', 'merge', f'origin/{args.b}'], cwd=args.src)
|
||||||
|
if p.returncode != 0:
|
||||||
|
return 1
|
||||||
p = subprocess.run(['git', 'merge', 'origin/master'], cwd=args.src)
|
p = subprocess.run(['git', 'merge', 'origin/master'], cwd=args.src)
|
||||||
|
if p.returncode != 0:
|
||||||
|
p = subprocess.run(['git', 'merge', 'origin/main'], cwd=args.src)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
return 1
|
return 1
|
||||||
if args.b:
|
if args.build:
|
||||||
if args.dest is None:
|
args.dest = args.build
|
||||||
print('need --dest argument for -b', file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
site_build(args)
|
site_build(args)
|
||||||
else:
|
else:
|
||||||
print('up to date')
|
print('up to date')
|
||||||
|
@ -78,10 +82,10 @@ if __name__ == '__main__':
|
||||||
parser_build.set_defaults(func=site_build)
|
parser_build.set_defaults(func=site_build)
|
||||||
|
|
||||||
parser_update.add_argument('--src', required=True)
|
parser_update.add_argument('--src', required=True)
|
||||||
parser_update.add_argument('--dest', required=False)
|
parser_update.add_argument('--build', required=False, help='build after updating from remote repository, takes destination directory as an argument')
|
||||||
parser_update.add_argument('-b', action='store_true', required=False)
|
parser_update.add_argument('-b', required=False, help='remote git branch to pull from')
|
||||||
parser_build.add_argument('--src', required=True)
|
parser_build.add_argument('--src', required=False, default='.')
|
||||||
parser_build.add_argument('--dest', required=True)
|
parser_build.add_argument('dest')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
rc = args.func(args)
|
rc = args.func(args)
|
||||||
|
|
Loading…
Reference in New Issue