[svk-commit] r3112 - in branches/git-storage/lib/SVK: Depot Root
nobody at bestpractical.com
nobody at bestpractical.com
Thu Oct 30 05:47:02 EDT 2008
Author: clsung
Date: Thu Oct 30 05:47:01 2008
New Revision: 3112
Modified:
branches/git-storage/lib/SVK/Depot/Git.pm
branches/git-storage/lib/SVK/Root/Git.pm
branches/git-storage/lib/SVK/Test.pm
branches/git-storage/lib/SVK/XD.pm
Log:
- hacking depot_delta
Modified: branches/git-storage/lib/SVK/Depot/Git.pm
==============================================================================
--- branches/git-storage/lib/SVK/Depot/Git.pm (original)
+++ branches/git-storage/lib/SVK/Depot/Git.pm Thu Oct 30 05:47:01 2008
@@ -3,6 +3,7 @@
use SVK::Version; our $VERSION = $SVK::VERSION;
use base 'SVK::Depot';
+use constant EMPTY_TREE => '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
sub repos {
Carp::confess "should not access git depot repos";
Modified: branches/git-storage/lib/SVK/Root/Git.pm
==============================================================================
--- branches/git-storage/lib/SVK/Root/Git.pm (original)
+++ branches/git-storage/lib/SVK/Root/Git.pm Thu Oct 30 05:47:01 2008
@@ -8,11 +8,15 @@
my $refs = [ map { m/.*? (.*)/ }
$self->depot->run_cmd('show-ref') =~ m/^.*$/mg ];
my $re = join('|', @$refs);
- if (my ($tree, $path) = $full_path =~ m{^/($re)(?:/(.*))?$}) {
+ my ($tree, $path);
+ if (($tree, $path) = $full_path =~ m{^/($re)(?:/(.*))?$}) {
$path = '' unless defined $path;
- my ($ref) = $self->depot->run_cmd("show-ref $tree") =~ m/^(.*?) /;
- return ($ref, $path);
+ } else {
+ $tree = 'refs/heads/master';
+ $path = substr($full_path,1);
}
+ my ($ref) = $self->depot->run_cmd("show-ref $tree") =~ m/^(.*?) /;
+ return ($ref, $path);
}
sub file_contents {
Modified: branches/git-storage/lib/SVK/Test.pm
==============================================================================
--- branches/git-storage/lib/SVK/Test.pm (original)
+++ branches/git-storage/lib/SVK/Test.pm Thu Oct 30 05:47:01 2008
@@ -266,7 +266,7 @@
for my $depotname (sort keys %{$xd->{depotmap}}) {
my $pool = SVN::Pool->new_default;
my $depot = eval { $xd->find_depot($depotname) } or next;
- next unless $depot->repos;
+ next if $depot->isa('SVK::Depot::Git');
my @txns = @{ $depot->repos->fs->list_transactions };
if (@txns) {
my $how_many = @txns;
Modified: branches/git-storage/lib/SVK/XD.pm
==============================================================================
--- branches/git-storage/lib/SVK/XD.pm (original)
+++ branches/git-storage/lib/SVK/XD.pm Thu Oct 30 05:47:01 2008
@@ -966,6 +966,7 @@
sub depot_delta {
my ($self, %arg) = @_;
+ return $self->depot_git_delta(%arg) if $arg{oldroot}->isa ('SVK::Root::Git');
my @root = map {$_->isa ('SVK::Root') ? $_->root : $_} @arg{qw/oldroot newroot/};
my $editor = $arg{editor};
SVN::Repos::dir_delta ($root[0], @{$arg{oldpath}},
@@ -978,6 +979,16 @@
$arg{pool});
}
+sub depot_git_delta {
+ my ($self, %arg) = @_;
+ my $oldroot = $arg{oldroot};
+ my $editor = $arg{editor};
+ # XXX: how about new root?
+ # XXX: Git use git diff EMPTY_TREE to generate the whole delta
+ my $textdiff =
+ $oldroot->depot->run_cmd('diff '.SVK::Depot::Git::EMPTY_TREE.' master') ;
+}
+
=item checkout_delta
Generate C<SVN::Delta::Editor> calls to represent the local changes
More information about the svk-commit
mailing list