@matheusbsbs / matheus-bagliano / commits / 51e057cf80
Fork 0

git-svn: add git svn proplist

This allows one to easily retrieve a list of svn properties from within git-svn without requiring svn or knowing the URL of a repository. * git-svn.perl (%cmd): Add the command `proplist'. (&cmd_proplist): New. * t/t9101-git-svn-props.sh: Test git svn proplist. Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Benoit Sigoure committed Oct 16, 2007 at 16:36 UTC 51e057cf808eb1c277da08f42d0ccd611ea315cc
2 files changed +38 -1
git-svn.perl
+17 -1
@@ -135,6 +135,9 @@ my %cmd = (
135 'propget' => [ \&cmd_propget,
136 'Print the value of a property on a file or directory',
137 { 'revision|r=i' => \$_revision } ],
138 + 'proplist' => [ \&cmd_proplist,
139 + 'List all properties of a file or directory',
140 + { 'revision|r=i' => \$_revision } ],
141 'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings",
142 { 'revision|r=i' => \$_revision
143 } ],
@@ -536,7 +539,7 @@ sub cmd_create_ignore {
539
540 # get_svnprops(PATH)
541 # ------------------
539 -# Helper for cmd_propget below.
542 +# Helper for cmd_propget and cmd_proplist below.
543 sub get_svnprops {
544 my $path = shift;
545 my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
@@ -583,6 +586,19 @@ sub cmd_propget {
586 print $props->{$prop} . "\n";
587 }
588
589 +# cmd_proplist (PATH)
590 +# -------------------
591 +# Print the list of SVN properties for PATH.
592 +sub cmd_proplist {
593 + my $path = shift;
594 + $path = '.' if not defined $path;
595 + my $props = get_svnprops($path);
596 + print "Properties on '$path':\n";
597 + foreach (sort keys %{$props}) {
598 + print " $_\n";
599 + }
600 +}
601 +
602 sub cmd_multi_init {
603 my $url = shift;
604 unless (defined $_trunk || defined $_branches || defined $_tags) {
t/t9101-git-svn-props.sh
+21
@@ -193,4 +193,25 @@ test_expect_success 'test propget' "
193 git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
194 "
195
196 +cat >prop.expect <<\EOF
197 +Properties on '.':
198 + svn:entry:committed-date
199 + svn:entry:committed-rev
200 + svn:entry:last-author
201 + svn:entry:uuid
202 + svn:ignore
203 +EOF
204 +cat >prop2.expect <<\EOF
205 +Properties on 'nested/directory/.keep':
206 + svn:entry:committed-date
207 + svn:entry:committed-rev
208 + svn:entry:last-author
209 + svn:entry:uuid
210 +EOF
211 +
212 +test_expect_success 'test proplist' "
213 + git-svn proplist . | cmp - prop.expect &&
214 + git-svn proplist nested/directory/.keep | cmp - prop2.expect
215 + "
216 +
217 test_done