[FYI/PATCH 1/5] Git::SVN: introduce path accessor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael G. Schwern <schwern@xxxxxxxxx>
Date: Fri, 27 Jul 2012 13:00:48 -0700

Each Git::SVN handle has a (base) URL and a (relative) path pointing
to the top-level directory of the branch it handles.  Introduce a
getter and setter for the path as preparation for automatically
canonicalizing it when reading or writing.

For example, instead of

	$oldpath = $gs->{path};
	$gs->{path} = $url;
	$gs->{path} =~ s!^\Q$min_url\E(/|$)!!;

now you can write

	$oldpath = $gs->path;
	$url =~ s!^\Q$min_url\E(/|$)!!;
	$gs->path($url);

[jn: split from a larger patch]

Signed-off-by: Eric Wong <normalperson@xxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 perl/Git/SVN.pm |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index b8b34744..268e0e84 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -2282,6 +2282,18 @@ sub _new {
 	        map_root => "$dir/.rev_map", repo_id => $repo_id }, $class;
 }
 
+sub path {
+	my $self = shift;
+
+	if (@_) {
+		my $path = shift;
+		$self->{path} = $path;
+		return;
+	}
+
+	return $self->{path};
+}
+
 # for read-only access of old .rev_db formats
 sub unlink_rev_db_symlink {
 	my ($self) = @_;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]