Show More
@@ -1,58 +1,58 b'' | |||
|
1 | #!/bin/bash | |
|
1 | #!/usr/bin/env bash | |
|
2 | 2 | # A simple script for opening merge conflicts in the editor. |
|
3 | 3 | # Use the following Mercurial settings to enable it. |
|
4 | 4 | # |
|
5 | 5 | # [ui] |
|
6 | 6 | # merge = editmerge |
|
7 | 7 | # |
|
8 | 8 | # [merge-tools] |
|
9 | 9 | # editmerge.args=$output |
|
10 | 10 | # editmerge.check=changed |
|
11 | 11 | # editmerge.premerge=keep |
|
12 | 12 | |
|
13 | 13 | FILE=$1 |
|
14 | 14 | |
|
15 | 15 | getlines() { |
|
16 | 16 | grep -n "<<<<<<" $FILE | cut -f1 -d: |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | # editor preference loosely based on http://mercurial.selenic.com/wiki/editor |
|
20 | 20 | # hg showconfig is at the bottom though, since it's slow to run (0.15 seconds) |
|
21 | 21 | ED=$HGEDITOR |
|
22 | 22 | if [ "$ED" = "" ] ; then |
|
23 | 23 | ED=$VISUAL |
|
24 | 24 | fi |
|
25 | 25 | if [ "$ED" = "" ] ; then |
|
26 | 26 | ED=$EDITOR |
|
27 | 27 | fi |
|
28 | 28 | if [ "$ED" = "" ] ; then |
|
29 | 29 | ED=$(hg showconfig ui.editor) |
|
30 | 30 | fi |
|
31 | 31 | if [ "$ED" = "" ] ; then |
|
32 | 32 | echo "merge failed - unable to find editor" |
|
33 | 33 | exit 1 |
|
34 | 34 | fi |
|
35 | 35 | |
|
36 | 36 | if [ "$ED" = "emacs" ] || [ "$ED" = "nano" ] || [ "$ED" = "vim" ] ; then |
|
37 | 37 | FIRSTLINE=$(getlines | head -n 1) |
|
38 | 38 | PREVIOUSLINE="" |
|
39 | 39 | |
|
40 | 40 | # open the editor to the first conflict until there are no more |
|
41 | 41 | # or the user stops editing the file |
|
42 | 42 | while [ ! "$FIRSTLINE" = "" ] && [ ! "$FIRSTLINE" = "$PREVIOUSLINE" ] ; do |
|
43 | 43 | $ED +$FIRSTLINE $FILE |
|
44 | 44 | PREVIOUSLINE=$FIRSTLINE |
|
45 | 45 | FIRSTLINE=$(getlines | head -n 1) |
|
46 | 46 | done |
|
47 | 47 | else |
|
48 | 48 | $ED $FILE |
|
49 | 49 | fi |
|
50 | 50 | |
|
51 | 51 | # get the line numbers of the remaining conflicts |
|
52 | 52 | CONFLICTS=$(getlines | sed ':a;N;$!ba;s/\n/, /g') |
|
53 | 53 | if [ ! "$CONFLICTS" = "" ] ; then |
|
54 | 54 | echo "merge failed - resolve the conflicts (line $CONFLICTS) then use 'hg resolve --mark'" |
|
55 | 55 | exit 1 |
|
56 | 56 | fi |
|
57 | 57 | |
|
58 | 58 | exit 0 |
@@ -1,89 +1,89 b'' | |||
|
1 | #!/bin/bash | |
|
1 | #!/usr/bin/env bash | |
|
2 | 2 | |
|
3 | 3 | # Measure the performance of a list of revsets against multiple revisions |
|
4 | 4 | # defined by parameter. Checkout one by one and run perfrevset with every |
|
5 | 5 | # revset in the list to benchmark its performance. |
|
6 | 6 | # |
|
7 | 7 | # - First argument is a revset of mercurial own repo to runs against. |
|
8 | 8 | # - Second argument is the file from which the revset array will be taken |
|
9 | 9 | # If second argument is omitted read it from standard input |
|
10 | 10 | # |
|
11 | 11 | # You should run this from the root of your mercurial repository. |
|
12 | 12 | # |
|
13 | 13 | # This script also does one run of the current version of mercurial installed |
|
14 | 14 | # to compare performance. |
|
15 | 15 | |
|
16 | 16 | HG="hg update" |
|
17 | 17 | PERF="./hg --config extensions.perf=contrib/perf.py perfrevset" |
|
18 | 18 | BASE_PERF="hg --config extensions.perf=contrib/perf.py perfrevset" |
|
19 | 19 | |
|
20 | 20 | TARGETS=$1 |
|
21 | 21 | shift |
|
22 | 22 | # read from a file or from standard output |
|
23 | 23 | if [ $# -ne 0 ]; then |
|
24 | 24 | readarray REVSETS < $1 |
|
25 | 25 | else |
|
26 | 26 | readarray REVSETS |
|
27 | 27 | fi |
|
28 | 28 | |
|
29 | 29 | hg update --quiet |
|
30 | 30 | |
|
31 | 31 | echo "Starting time benchmarking" |
|
32 | 32 | echo |
|
33 | 33 | |
|
34 | 34 | echo "Revsets to benchmark" |
|
35 | 35 | echo "----------------------------" |
|
36 | 36 | |
|
37 | 37 | for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
38 | 38 | do |
|
39 | 39 | echo "${j}) ${REVSETS[$j]}" |
|
40 | 40 | done |
|
41 | 41 | |
|
42 | 42 | echo "----------------------------" |
|
43 | 43 | echo |
|
44 | 44 | |
|
45 | 45 | # Benchmark baseline |
|
46 | 46 | echo "Benchmarking baseline" |
|
47 | 47 | |
|
48 | 48 | for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
49 | 49 | do |
|
50 | 50 | echo -n "${j}) " |
|
51 | 51 | $BASE_PERF "${REVSETS[$j]}" |
|
52 | 52 | done |
|
53 | 53 | |
|
54 | 54 | echo |
|
55 | 55 | echo |
|
56 | 56 | |
|
57 | 57 | # Benchmark revisions |
|
58 | 58 | for i in $(hg log --template='{rev}\n' --rev $TARGETS); |
|
59 | 59 | do |
|
60 | 60 | echo "----------------------------" |
|
61 | 61 | echo -n "Revision: " |
|
62 | 62 | hg log -r $i --template "{desc|firstline}" |
|
63 | 63 | |
|
64 | 64 | echo "----------------------------" |
|
65 | 65 | $HG $i |
|
66 | 66 | for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
67 | 67 | do |
|
68 | 68 | echo -n "${j}) " |
|
69 | 69 | $PERF "${REVSETS[$j]}" |
|
70 | 70 | done |
|
71 | 71 | echo "----------------------------" |
|
72 | 72 | done |
|
73 | 73 | |
|
74 | 74 | $HG |
|
75 | 75 | |
|
76 | 76 | # Benchmark current code |
|
77 | 77 | echo "Benchmarking current code" |
|
78 | 78 | |
|
79 | 79 | for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
80 | 80 | do |
|
81 | 81 | echo -n "${j}) " |
|
82 | 82 | $PERF "${REVSETS[$j]}" |
|
83 | 83 | done |
|
84 | 84 | |
|
85 | 85 | |
|
86 | 86 | echo |
|
87 | 87 | echo "Time benchmarking finished" |
|
88 | 88 | |
|
89 | 89 |
General Comments 0
You need to be logged in to leave comments.
Login now