diff options
-rwxr-xr-x | git-svn.perl | 18 | ||||
-rwxr-xr-x | t/t9101-git-svn-props.sh | 21 |
2 files changed, 38 insertions, 1 deletions
diff --git a/git-svn.perl b/git-svn.perl index e97eba21f..22fca5946 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -135,6 +135,9 @@ my %cmd = ( 'propget' => [ \&cmd_propget, 'Print the value of a property on a file or directory', { 'revision|r=i' => \$_revision } ], + 'proplist' => [ \&cmd_proplist, + 'List all properties of a file or directory', + { 'revision|r=i' => \$_revision } ], 'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings", { 'revision|r=i' => \$_revision } ], @@ -536,7 +539,7 @@ sub cmd_create_ignore { # get_svnprops(PATH) # ------------------ -# Helper for cmd_propget below. +# Helper for cmd_propget and cmd_proplist below. sub get_svnprops { my $path = shift; my ($url, $rev, $uuid, $gs) = working_head_info('HEAD'); @@ -583,6 +586,19 @@ sub cmd_propget { print $props->{$prop} . "\n"; } +# cmd_proplist (PATH) +# ------------------- +# Print the list of SVN properties for PATH. +sub cmd_proplist { + my $path = shift; + $path = '.' if not defined $path; + my $props = get_svnprops($path); + print "Properties on '$path':\n"; + foreach (sort keys %{$props}) { + print " $_\n"; + } +} + sub cmd_multi_init { my $url = shift; unless (defined $_trunk || defined $_branches || defined $_tags) { diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 61c879959..3c83127a0 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -193,4 +193,25 @@ test_expect_success 'test propget' " git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect " +cat >prop.expect <<\EOF +Properties on '.': + svn:entry:committed-date + svn:entry:committed-rev + svn:entry:last-author + svn:entry:uuid + svn:ignore +EOF +cat >prop2.expect <<\EOF +Properties on 'nested/directory/.keep': + svn:entry:committed-date + svn:entry:committed-rev + svn:entry:last-author + svn:entry:uuid +EOF + +test_expect_success 'test proplist' " + git-svn proplist . | cmp - prop.expect && + git-svn proplist nested/directory/.keep | cmp - prop2.expect + " + test_done |