equal
deleted
inserted
replaced
|
1 #!/bin/bash |
|
2 # |
|
3 # A simple script that has to be run after hg merge due to |
|
4 # missing renames in history |
|
5 # |
|
6 # |
|
7 |
|
8 MY_BRANCH=$(hg branch) |
|
9 BAD_FILES=$(ls Tools_[A-Z]*.st) |
|
10 LAST_MERGE_REV=$(hg log -r "children(ancestor(default, $MY_BRANCH)) and merge() and branch($MY_BRANCH)" --template "{node|short}\n") |
|
11 LAST_MERGED_REV=$(hg log -r $LAST_MERGE_REV --template "{parents}" | cut -d ' ' -f 2 | cut -d ':' -f 2) |
|
12 |
|
13 echo "Last merge with default was $LAST_MERGE_REV" |
|
14 echo "Last merged default was $LAST_MERGED_REV:" |
|
15 hg log -r $LAST_MERGED_REV |
|
16 |
|
17 for bad_file in $BAD_FILES; do |
|
18 good_file=$(echo $bad_file | sed -e 's/_/__/g') |
|
19 echo "Fixing $bad_file -> $good_file" |
|
20 default_last_change_rev=$(hg log -b default $bad_file -l 1 --template "{node|short}\n") |
|
21 if [ "$default_last_change_rev" != "$LAST_MERGED_REV" ]; then |
|
22 echo " Changed since last merge (latest is $default_last_change_rev)" |
|
23 cp $good_file $good_file.orig |
|
24 cp $good_file $good_file.local |
|
25 hg cat -r "$default_last_change_rev" "$bad_file" > "$good_file.other" |
|
26 hg cat -r "$LAST_MERGED_REV" "$bad_file" > "$good_file.base" |
|
27 hg resolve --unmark "$good_file" |
|
28 fi |
|
29 done |