view tests/test-convert-svn-sink.out @ 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 14db59e3b248
children f2daa6ab514a 28642f7fc2cf
line wrap: on
line source

% add
adding a
adding d1/d2/b
% modify
1:e0e2b8a9156b
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
1 add a file
0 modify a file
At revision 2.
 2 2 test .
 2 2 test a
 2 1 test d1
 2 1 test d1/d2
 2 1 test d1/d2/b
<?xml version="1.0"?>
<log>
<logentry
   revision="2">
<author>test</author>
<date/>
<paths>
<path
   action="M">/a</path>
</paths>
<msg>modify a file</msg>
</logentry>
<logentry
   revision="1">
<author>test</author>
<date/>
<paths>
<path
   action="A">/a</path>
<path
   action="A">/d1</path>
<path
   action="A">/d1/d2</path>
<path
   action="A">/d1/d2/b</path>
</paths>
<msg>add a file</msg>
</logentry>
</log>
a:
a
d1

a-hg-wc:
a
d1
same
% rename
2:eb5169441d43
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 rename a file
At revision 3.
 3 3 test .
 3 3 test b
 3 1 test d1
 3 1 test d1/d2
 3 1 test d1/d2/b
<?xml version="1.0"?>
<log>
<logentry
   revision="3">
<author>test</author>
<date/>
<paths>
<path
   action="D">/a</path>
<path
   copyfrom-path="/a"
   copyfrom-rev="2"
   action="A">/b</path>
</paths>
<msg>rename a file</msg>
</logentry>
</log>
a:
b
d1

a-hg-wc:
b
d1
% copy
3:60effef6ab48
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 copy a file
At revision 4.
 4 4 test .
 4 3 test b
 4 4 test c
 4 1 test d1
 4 1 test d1/d2
 4 1 test d1/d2/b
<?xml version="1.0"?>
<log>
<logentry
   revision="4">
<author>test</author>
<date/>
<paths>
<path
   copyfrom-path="/b"
   copyfrom-rev="3"
   action="A">/c</path>
</paths>
<msg>copy a file</msg>
</logentry>
</log>
a:
b
c
d1

a-hg-wc:
b
c
d1
% remove
4:87bbe3013fb6
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 remove a file
At revision 5.
 5 5 test .
 5 4 test c
 5 1 test d1
 5 1 test d1/d2
 5 1 test d1/d2/b
<?xml version="1.0"?>
<log>
<logentry
   revision="5">
<author>test</author>
<date/>
<paths>
<path
   action="D">/b</path>
</paths>
<msg>remove a file</msg>
</logentry>
</log>
a:
c
d1

a-hg-wc:
c
d1
% executable
5:ff42e473c340
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 make a file executable
At revision 6.
 6 6 test .
 6 6 test c
 6 1 test d1
 6 1 test d1/d2
 6 1 test d1/d2/b
<?xml version="1.0"?>
<log>
<logentry
   revision="6">
<author>test</author>
<date/>
<paths>
<path
   action="M">/c</path>
</paths>
<msg>make a file executable</msg>
</logentry>
</log>
executable
% executable in new directory
adding d1/a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 add executable file in new directory
At revision 1.
 1 1 test .
 1 1 test d1
 1 1 test d1/a
<?xml version="1.0"?>
<log>
<logentry
   revision="1">
<author>test</author>
<date/>
<paths>
<path
   action="A">/d1</path>
<path
   action="A">/d1/a</path>
</paths>
<msg>add executable file in new directory</msg>
</logentry>
</log>
executable
% copy to new directory
assuming destination a-hg
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
0 copy file to new directory
At revision 2.
 2 2 test .
 2 1 test d1
 2 1 test d1/a
 2 2 test d2
 2 2 test d2/a
<?xml version="1.0"?>
<log>
<logentry
   revision="2">
<author>test</author>
<date/>
<paths>
<path
   action="A">/d2</path>
<path
   copyfrom-path="/d1/a"
   copyfrom-rev="1"
   action="A">/d2/a</path>
</paths>
<msg>copy file to new directory</msg>
</logentry>
</log>
% branchy history
adding b
adding left-1
adding left-2
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
adding right-1
created new head
adding right-2
3 files updated, 0 files merged, 2 files removed, 0 files unresolved
merging b
warning: conflicts during merge.
merging b failed!
2 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
assuming destination b-hg
initializing svn repository 'b-hg'
initializing svn working copy 'b-hg-wc'
scanning source...
sorting...
converting...
5 base
4 left-1
3 left-2
2 right-1
1 right-2
0 merge
% expect 4 changes
At revision 4.
 4 4 test .
 4 3 test b
 4 2 test left-1
 4 3 test left-2
 4 4 test right-1
 4 4 test right-2
<?xml version="1.0"?>
<log>
<logentry
   revision="4">
<author>test</author>
<date/>
<paths>
<path
   action="A">/right-1</path>
<path
   action="A">/right-2</path>
</paths>
<msg>merge</msg>
</logentry>
<logentry
   revision="3">
<author>test</author>
<date/>
<paths>
<path
   action="M">/b</path>
<path
   action="A">/left-2</path>
</paths>
<msg>left-2</msg>
</logentry>
<logentry
   revision="2">
<author>test</author>
<date/>
<paths>
<path
   action="M">/b</path>
<path
   action="A">/left-1</path>
</paths>
<msg>left-1</msg>
</logentry>
<logentry
   revision="1">
<author>test</author>
<date/>
<paths>
<path
   action="A">/b</path>
</paths>
<msg>base</msg>
</logentry>
</log>
% tags are not supported, but must not break conversion
adding a
assuming destination a-hg
initializing svn repository 'a-hg'
initializing svn working copy 'a-hg-wc'
scanning source...
sorting...
converting...
1 Add file a
0 Tagged as v1.0
writing Subversion tags is not yet implemented
At revision 2.
 2 2 test .
 2 1 test a
 2 2 test .hgtags
<?xml version="1.0"?>
<log>
<logentry
   revision="2">
<author>test</author>
<date/>
<paths>
<path
   action="A">/.hgtags</path>
</paths>
<msg>Tagged as v1.0</msg>
</logentry>
<logentry
   revision="1">
<author>test</author>
<date/>
<paths>
<path
   action="A">/a</path>
</paths>
<msg>Add file a</msg>
</logentry>
</log>