Mercurial > hg
annotate tests/test-copy-move-merge.t @ 11989:f853873fc66d
aliases: provide more flexible ways to work with shell alias arguments
This patch changes the functionality of shell aliases to add more powerful
options for working with shell alias arguments.
First: the alias name + arguments to a shell alias are set as an HG_ARGS
environment variable, delimited by spaces. This matches the behavior of hooks.
Second: any occurrences of "$@" (without quotes) are replaced with the
arguments, separated by spaces. This happens *before* the alias gets to the shell.
Third: any positive numeric variables ("$1", "$2", etc) are replaced with the
appropriate argument, indexed from 1. "$0" is replaced with the name of the
alias. Any "extra" numeric variables are replaced with an empty string. This
happens *before* the alias gets to the shell.
These changes allow for more flexible shell aliases:
[alias]
echo = !echo $@
count = !hg log -r "$@" --template='.' | wc -c | sed -e 's/ //g'
qqueuemv = !mv "`hg root`/.hg/patches-$1" "`hg root`/.hg/patches-$2"
In action:
$ hg echo foo
foo
$ hg count 'branch(default)'
901
$ hg count 'branch(stable) and keyword(fixes)'
102
$ hg qqueuemv myfeature somefeature
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Wed, 18 Aug 2010 18:56:44 -0400 |
parents | b708cadc6e8f |
children | 4c94b6d0fb1c |
rev | line source |
---|---|
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
1 $ mkdir t |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
2 $ cd t |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
3 $ hg init |
5059
8d9bdcbb2b18
merge: avoid double deletion mentioned in issue636
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 |
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
5 $ echo 1 > a |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
6 $ hg ci -qAm "first" -d "1000000 0" |
5059
8d9bdcbb2b18
merge: avoid double deletion mentioned in issue636
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
7 |
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
8 $ hg cp a b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
9 $ hg mv a c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
10 $ echo 2 >> b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
11 $ echo 2 >> c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
12 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
13 $ hg ci -qAm "second" -d "1000000 0" |
5059
8d9bdcbb2b18
merge: avoid double deletion mentioned in issue636
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 |
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
15 $ hg co -C 0 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
16 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
17 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
18 $ echo 0 > a |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
19 $ echo 1 >> a |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
20 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
21 $ hg ci -qAm "other" -d "1000000 0" |
5059
8d9bdcbb2b18
merge: avoid double deletion mentioned in issue636
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 |
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
23 $ hg merge --debug |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
24 searching for copies back to rev 1 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
25 unmatched files in other: |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
26 b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
27 c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
28 all copies found (* = to merge, ! = divergent): |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
29 c -> a * |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
30 b -> a * |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
31 checking for directory renames |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
32 resolving manifests |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
33 overwrite None partial False |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
34 ancestor 583c7b748052 local fb3948d97f07+ remote 7f1309517659 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
35 a: remote moved to c -> m |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
36 a: remote moved to b -> m |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
37 preserving a for resolve of b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
38 preserving a for resolve of c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
39 removing a |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
40 updating: a 1/2 files (50.00%) |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
41 picked tool 'internal:merge' for b (binary False symlink False) |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
42 merging a and b to b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
43 my b@fb3948d97f07+ other b@7f1309517659 ancestor a@583c7b748052 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
44 premerge successful |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
45 updating: a 2/2 files (100.00%) |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
46 picked tool 'internal:merge' for c (binary False symlink False) |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
47 merging a and c to c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
48 my c@fb3948d97f07+ other c@7f1309517659 ancestor a@583c7b748052 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
49 premerge successful |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
50 0 files updated, 2 files merged, 0 files removed, 0 files unresolved |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
51 (branch merge, don't forget to commit) |
5059
8d9bdcbb2b18
merge: avoid double deletion mentioned in issue636
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
52 |
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
53 file b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
54 $ cat b |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
55 0 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
56 1 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
57 2 |
5059
8d9bdcbb2b18
merge: avoid double deletion mentioned in issue636
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
58 |
11972
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
59 file c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
60 $ cat c |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
61 0 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
62 1 |
b708cadc6e8f
tests: unify test-copy-move-merge
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
5059
diff
changeset
|
63 2 |