Mercurial > dotfiles
comparison unixSoft/bin/hgimp @ 521:6cc5a0550281
tools: port hg utility scripts to python 3
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Thu, 14 Jul 2022 14:09:04 -0400 |
parents | 957632211aa3 |
children |
comparison
equal
deleted
inserted
replaced
520:9af1fc9b713c | 521:6cc5a0550281 |
---|---|
27 c = [] | 27 c = [] |
28 for n in _MAP: | 28 for n in _MAP: |
29 if n.startswith(name): | 29 if n.startswith(name): |
30 c.append(n) | 30 c.append(n) |
31 if not c: | 31 if not c: |
32 print 'abort: no repo named %s' % name | 32 print('abort: no repo named %s' % name) |
33 sys.exit(1) | 33 sys.exit(1) |
34 elif len(c) != 1: | 34 elif len(c) != 1: |
35 print 'abort: ambiguous repo name %s matches %s' % ( | 35 print('abort: ambiguous repo name %s matches %s' % ( |
36 name, ', '.join(c)) | 36 name, ', '.join(c))) |
37 sys.exit(1) | 37 sys.exit(1) |
38 repo = _MAP[c[0]] | 38 repo = _MAP[c[0]] |
39 importargs = ['hg', '-R', repo, 'import', '--obsolete'] | 39 importargs = ['hg', '-R', repo, 'import', '--obsolete'] |
40 if args.partial: | 40 if args.partial: |
41 importargs.append('--partial') | 41 importargs.append('--partial') |
42 importargs.append('-') | 42 importargs.append('-') |
43 hg = subprocess.Popen(importargs, stdin=subprocess.PIPE) | 43 hg = subprocess.Popen(importargs, stdin=subprocess.PIPE) |
44 hg.stdin.write(sys.stdin.read()) | 44 hg.stdin.write(sys.stdin.buffer.read()) |
45 hg.stdin.close() | 45 hg.stdin.close() |
46 hg.wait() | 46 hg.wait() |
47 sys.exit(hg.returncode) | 47 sys.exit(hg.returncode) |
48 | 48 |
49 | 49 |