FreeBSD Bugzilla – Attachment 149387 Details for
Bug 194999
devel/git: Support for svn propset in git-svn
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to update the port.
D1154.diff (text/plain), 6.31 KB, created by
Alfred Perlstein
on 2014-11-14 02:21:26 UTC
(
hide
)
Description:
Patch to update the port.
Filename:
MIME Type:
Creator:
Alfred Perlstein
Created:
2014-11-14 02:21:26 UTC
Size:
6.31 KB
patch
obsolete
>Index: devel/git/files/patch-git-svn.perl >=================================================================== >--- /dev/null >+++ devel/git/files/patch-git-svn.perl >@@ -0,0 +1,80 @@ >+--- git-svn.perl.orig 2014-11-13 08:43:00 UTC >++++ git-svn.perl >+@@ -115,7 +115,7 @@ my ($_stdin, $_help, $_edit, >+ $_before, $_after, >+ $_merge, $_strategy, $_preserve_merges, $_dry_run, $_parents, $_local, >+ $_prefix, $_no_checkout, $_url, $_verbose, >+- $_commit_url, $_tag, $_merge_info, $_interactive); >++ $_commit_url, $_tag, $_merge_info, $_interactive, $_set_svn_props); >+ >+ # This is a refactoring artifact so Git::SVN can get at this git-svn switch. >+ sub opt_prefix { return $_prefix || '' } >+@@ -193,6 +193,7 @@ my %cmd = ( >+ 'dry-run|n' => \$_dry_run, >+ 'fetch-all|all' => \$_fetch_all, >+ 'commit-url=s' => \$_commit_url, >++ 'set-svn-props=s' => \$_set_svn_props, >+ 'revision|r=i' => \$_revision, >+ 'no-rebase' => \$_no_rebase, >+ 'mergeinfo=s' => \$_merge_info, >+@@ -228,6 +229,9 @@ my %cmd = ( >+ 'propget' => [ \&cmd_propget, >+ 'Print the value of a property on a file or directory', >+ { 'revision|r=i' => \$_revision } ], >++ 'propset' => [ \&cmd_propset, >++ 'Set the value of a property on a file or directory - will be set on commit', >++ {} ], >+ 'proplist' => [ \&cmd_proplist, >+ 'List all properties of a file or directory', >+ { 'revision|r=i' => \$_revision } ], >+@@ -1370,6 +1374,50 @@ sub cmd_propget { >+ print $props->{$prop} . "\n"; >+ } >+ >++# cmd_propset (PROPNAME, PROPVAL, PATH) >++# ------------------------ >++# Adjust the SVN property PROPNAME to PROPVAL for PATH. >++sub cmd_propset { >++ my ($propname, $propval, $path) = @_; >++ $path = '.' if not defined $path; >++ $path = $cmd_dir_prefix . $path; >++ usage(1) if not defined $propname; >++ usage(1) if not defined $propval; >++ my $file = basename($path); >++ my $dn = dirname($path); >++ # diff has check_attr locally, so just call direct >++ #my $current_properties = check_attr( "svn-properties", $path ); >++ my $current_properties = Git::SVN::Editor::check_attr( "svn-properties", $path ); >++ my $new_properties = ""; >++ if ($current_properties eq "unset" || $current_properties eq "" || $current_properties eq "set") { >++ $new_properties = "$propname=$propval"; >++ } else { >++ # TODO: handle combining properties better >++ my @props = split(/;/, $current_properties); >++ my $replaced_prop = 0; >++ foreach my $prop (@props) { >++ # Parse 'name=value' syntax and set the property. >++ if ($prop =~ /([^=]+)=(.*)/) { >++ my ($n,$v) = ($1,$2); >++ if ($n eq $propname) >++ { >++ $v = $propval; >++ $replaced_prop = 1; >++ } >++ if ($new_properties eq "") { $new_properties="$n=$v"; } >++ else { $new_properties="$new_properties;$n=$v"; } >++ } >++ } >++ if ($replaced_prop eq 0) { >++ $new_properties = "$new_properties;$propname=$propval"; >++ } >++ } >++ my $attrfile = "$dn/.gitattributes"; >++ open my $attrfh, '>>', $attrfile or die "Can't open $attrfile: $!\n"; >++ # TODO: don't simply append here if $file already has svn-properties >++ print $attrfh "$file svn-properties=$new_properties\n"; >++} >++ >+ # cmd_proplist (PATH) >+ # ------------------- >+ # Print the list of SVN properties for PATH. >Index: devel/git/files/patch-perl_Git_SVN_Editor.pm >=================================================================== >--- /dev/null >+++ devel/git/files/patch-perl_Git_SVN_Editor.pm >@@ -0,0 +1,92 @@ >+--- perl/Git/SVN/Editor.pm.orig 2014-09-30 19:00:40 UTC >++++ perl/Git/SVN/Editor.pm >+@@ -288,6 +288,57 @@ sub apply_autoprops { >+ } >+ } >+ >++sub check_attr >++{ >++ my ($attr,$path) = @_; >++ if ( open my $fh, '-|', "git", "check-attr", $attr, "--", $path ) >++ { >++ my $val = <$fh>; >++ close $fh; >++ $val =~ s/^[^:]*:\s*[^:]*:\s*(.*)\s*$/$1/; >++ return $val; >++ } >++ else >++ { >++ return undef; >++ } >++} >++ >++# From which subdir have we been invoked? >++my $cmd_dir_prefix = eval { >++ command_oneline([qw/rev-parse --show-prefix/], STDERR => 0) >++} || ''; >++ >++sub apply_manualprops { >++ my ($self, $file, $fbat) = @_; >++ my $path = $cmd_dir_prefix . $file; >++ # diff has ::check_attr >++ #my $pending_properties = ::check_attr( "svn-properties", $path ); >++ my $pending_properties = check_attr( "svn-properties", $path ); >++ if ($pending_properties eq "") { return; } >++ # Parse the list of properties to set. >++ my @props = split(/;/, $pending_properties); >++ # TODO: get existing properties to compare to - this fails for add so currently not done >++ # my $existing_props = ::get_svnprops($file); >++ my $existing_props = {}; >++ # TODO: caching svn properties or storing them in .gitattributes would make that faster >++ foreach my $prop (@props) { >++ # Parse 'name=value' syntax and set the property. >++ if ($prop =~ /([^=]+)=(.*)/) { >++ my ($n,$v) = ($1,$2); >++ for ($n, $v) { >++ s/^\s+//; s/\s+$//; >++ } >++ # FIXME: clearly I don't know perl and couldn't work out how to evaluate this better >++ if (defined $existing_props->{$n} && $existing_props->{$n} eq $v) { >++ my $needed = 0; >++ } else { >++ $self->change_file_prop($fbat, $n, $v); >++ } >++ } >++ } >++} >++ >+ sub A { >+ my ($self, $m, $deletions) = @_; >+ my ($dir, $file) = split_path($m->{file_b}); >+@@ -296,6 +347,7 @@ sub A { >+ undef, -1); >+ print "\tA\t$m->{file_b}\n" unless $::_q; >+ $self->apply_autoprops($file, $fbat); >++ $self->apply_manualprops($file, $fbat); >+ $self->chg_file($fbat, $m); >+ $self->close_file($fbat,undef,$self->{pool}); >+ } >+@@ -311,6 +363,7 @@ sub C { >+ my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat, >+ $upa, $self->{r}); >+ print "\tC\t$m->{file_a} => $m->{file_b}\n" unless $::_q; >++ $self->apply_manualprops($file, $fbat); >+ $self->chg_file($fbat, $m); >+ $self->close_file($fbat,undef,$self->{pool}); >+ } >+@@ -333,6 +386,7 @@ sub R { >+ $upa, $self->{r}); >+ print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q; >+ $self->apply_autoprops($file, $fbat); >++ $self->apply_manualprops($file, $fbat); >+ $self->chg_file($fbat, $m); >+ $self->close_file($fbat,undef,$self->{pool}); >+ >+@@ -348,6 +402,7 @@ sub M { >+ my $fbat = $self->open_file($self->repo_path($m->{file_b}), >+ $pbat,$self->{r},$self->{pool}); >+ print "\t$m->{chg}\t$m->{file_b}\n" unless $::_q; >++ $self->apply_manualprops($file, $fbat); >+ $self->chg_file($fbat, $m); >+ $self->close_file($fbat,undef,$self->{pool}); >+ }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194999
: 149387