git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org, gitster@pobox.com, robbat2@gentoo.org,
	bwalton@artsci.utoronto.ca,
	"Michael G. Schwern" <schwern@pobox.com>
Subject: [FYI/PATCH 1/5] Git::SVN: introduce path accessor
Date: Mon, 17 Sep 2012 02:08:20 -0700	[thread overview]
Message-ID: <20120917090820.GB358@elie.Belkin> (raw)
In-Reply-To: <20120917090435.GA358@elie.Belkin>

From: Michael G. Schwern <schwern@pobox.com>
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@yhbt.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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

  reply	other threads:[~2012-09-17  9:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 20:00 Make git-svn Use accessors for paths and urls Michael G. Schwern
2012-07-27 20:00 ` [PATCH 1/5] Make Git::SVN use accessors internally for path Michael G. Schwern
2012-09-17  9:04   ` Jonathan Nieder
2012-09-17  9:08     ` Jonathan Nieder [this message]
2012-09-17  9:09     ` [FYI/PATCH 2/5] Git::SVN: use accessor to read path Jonathan Nieder
2012-09-17  9:10     ` [FYI/PATCH 3/5] Git::SVN: use accessor to write path Jonathan Nieder
2012-09-17  9:12     ` [FYI/PATCH 4/5] Git::SVN::_new: use accessor to write path field Jonathan Nieder
2012-09-17  9:13     ` [PATCH/RFC 5/5] Git::SVN: rename private " Jonathan Nieder
2012-09-18  0:00       ` Junio C Hamano
2012-09-18  0:07       ` Eric Wong
2012-07-27 20:00 ` [PATCH 2/5] Make Git::SVN use an accessor for URLs internally Michael G. Schwern
2012-07-27 20:00 ` [PATCH 3/5] Make Git::SVN::Ra use an accessor for URLs Michael G. Schwern
2012-07-27 20:00 ` [PATCH 4/5] Change the rest of the code to use Git::SVN->path instead of the hash directly Michael G. Schwern
2012-07-27 20:00 ` [PATCH 5/5] Change the rest of the code to use the Git::SVN and Git::SVN::Ra url accessors Michael G. Schwern
2012-07-28  2:59   ` Eric Wong
2012-07-28  3:10 ` Make git-svn Use accessors for paths and urls Jonathan Nieder
2012-07-28  7:40   ` Michael G Schwern
2012-07-28  7:54     ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120917090820.GB358@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=bwalton@artsci.utoronto.ca \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    --cc=robbat2@gentoo.org \
    --cc=schwern@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).