Skip to content

Commit 5ab8e6b

Browse files
author
Yaniv Inbar
committed
http: hack to support hg cp
https://codereview.appspot.com/9536043/
1 parent c632a8f commit 5ab8e6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

hg_import.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
deleted_re = re.compile('^deleted file mode \S+$')
2525
fp = re.compile('^rename from (\S+)$')
2626
tp = re.compile('^rename to (\S+)$')
27+
fcp = re.compile('^copy from (\S+)$')
28+
tcp = re.compile('^copy to (\S+)$')
2729
hg_cmd = 'hg'
2830

2931
if len(sys.argv) == 1:
@@ -56,5 +58,14 @@
5658
if m:
5759
hg_to = m.group(1)
5860
subprocess.check_call([hg_cmd, 'mv', '-f', hg_from, hg_to])
61+
# detect copied file
62+
m = fcp.search(line)
63+
if m:
64+
hg_from = m.group(1)
65+
m = tcp.search(line)
66+
if m:
67+
hg_to = m.group(1)
68+
subprocess.check_call([hg_cmd, 'cp', hg_from, hg_to])
69+
subprocess.check_call([hg_cmd, 'revert', '--no-backup', hg_from])
5970
webFile.close()
6071

0 commit comments

Comments
 (0)