r25592 - in /trunk/libgit-fastexport-perl: Changes MANIFEST META.yml debian/changelog debian/control debian/rules lib/Git/FastExport.pm script/git-stitch-repo t/10fast-export.t t/30stitch-repo.t t/Utils.pm t/git-fast-export.t

efaistos-guest at users.alioth.debian.org efaistos-guest at users.alioth.debian.org
Wed Sep 24 17:29:49 UTC 2008


Author: efaistos-guest
Date: Wed Sep 24 17:29:46 2008
New Revision: 25592

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=25592
Log:
rules: cancelled the installation of the README file; control: removed spurious .; control: added dependency on git-core and enabled libtest-pod-perl and libtest-pod-coverage-perl in B-D-I

Added:
    trunk/libgit-fastexport-perl/t/10fast-export.t
      - copied unchanged from r25591, branches/upstream/libgit-fastexport-perl/current/t/10fast-export.t
    trunk/libgit-fastexport-perl/t/30stitch-repo.t
      - copied unchanged from r25591, branches/upstream/libgit-fastexport-perl/current/t/30stitch-repo.t
    trunk/libgit-fastexport-perl/t/Utils.pm
      - copied unchanged from r25591, branches/upstream/libgit-fastexport-perl/current/t/Utils.pm
Removed:
    trunk/libgit-fastexport-perl/t/git-fast-export.t
Modified:
    trunk/libgit-fastexport-perl/Changes
    trunk/libgit-fastexport-perl/MANIFEST
    trunk/libgit-fastexport-perl/META.yml
    trunk/libgit-fastexport-perl/debian/changelog
    trunk/libgit-fastexport-perl/debian/control
    trunk/libgit-fastexport-perl/debian/rules
    trunk/libgit-fastexport-perl/lib/Git/FastExport.pm
    trunk/libgit-fastexport-perl/script/git-stitch-repo

Modified: trunk/libgit-fastexport-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/Changes?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/Changes (original)
+++ trunk/libgit-fastexport-perl/Changes Wed Sep 24 17:29:46 2008
@@ -1,4 +1,20 @@
 Revision history for Perl extension Git::FastExport
+
+0.04 Wed Aug 20 22:04:30 CEST 2008
+        [ENHANCEMENTS]
+        - git-stitch-repo: fixed a bug that caused many commits/branches
+          to be lost because different branches were given the same name.
+        [DOCUMENTATION]
+        - improved documentation for git-stitch-repo
+        [TESTS]
+        - t/30stitch-repot.t actually tests the results of running
+          git-stitch-repo on several different configurations
+
+0.03 Mon Jul  7 19:29:23 CEST 2008
+        [ENHANCEMENTS]
+        - git-stitch-repo: fixed a segmentation fault that occured
+          at program destruction, because of a huge self-referential
+          hash of hashes
 
 0.02 Fri Jul  4 11:03:54 CEST 2008
         [DOCUMENTATION]

Modified: trunk/libgit-fastexport-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/MANIFEST?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/MANIFEST (original)
+++ trunk/libgit-fastexport-perl/MANIFEST Wed Sep 24 17:29:46 2008
@@ -8,7 +8,9 @@
 script/git-stitch-repo
 t/00load.t
 t/01new.t
+t/10fast-export.t
+t/30stitch-repo.t
 t/fast-export
-t/git-fast-export.t
 t/pod-coverage.t
 t/pod.t
+t/Utils.pm

Modified: trunk/libgit-fastexport-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/META.yml?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/META.yml (original)
+++ trunk/libgit-fastexport-perl/META.yml Wed Sep 24 17:29:46 2008
@@ -1,6 +1,6 @@
 ---
 name: Git-FastExport
-version: 0.02
+version: 0.04
 author: []
 abstract: A module to parse the output of git-fast-export
 license: perl
@@ -11,7 +11,7 @@
 provides:
   Git::FastExport:
     file: lib/Git/FastExport.pm
-    version: 0.02
+    version: 0.04
   Git::FastExport::Block:
     file: lib/Git/FastExport.pm
 generated_by: Module::Build version 0.2808

Modified: trunk/libgit-fastexport-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/debian/changelog?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/debian/changelog (original)
+++ trunk/libgit-fastexport-perl/debian/changelog Wed Sep 24 17:29:46 2008
@@ -1,4 +1,4 @@
-libgit-fastexport-perl (0.02-1) unstable; urgency=low
+libgit-fastexport-perl (0.04-1) unstable; urgency=low
 
   * Initial Release. (Closes: #489145)
 

Modified: trunk/libgit-fastexport-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/debian/control?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/debian/control (original)
+++ trunk/libgit-fastexport-perl/debian/control Wed Sep 24 17:29:46 2008
@@ -2,7 +2,7 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 5), libmodule-build-perl
-Build-Depends-Indep: perl (>= 5.6.10-12), libfile-slurp-perl
+Build-Depends-Indep: perl (>= 5.6.10-12), libfile-slurp-perl, libtest-pod-perl, libtest-pod-coverage-perl, git-core
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Edi Stojicevic <estojicevic at debianworld.org>
 Standards-Version: 3.8.0
@@ -14,7 +14,6 @@
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}
 Description: A module to parse the output of git-fast-export
- .
  Git::FastExport is a module that parses the output of
  git-fast-export and returns Git::FastExport::Block objects that
  can be inspected or modified before being eventually passed on as the

Modified: trunk/libgit-fastexport-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/debian/rules?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/debian/rules (original)
+++ trunk/libgit-fastexport-perl/debian/rules Wed Sep 24 17:29:46 2008
@@ -49,7 +49,7 @@
 binary-indep: build install
 	dh_testdir
 	dh_testroot
-	dh_installdocs README
+	dh_installdocs 
 	dh_installchangelogs Changes
 	dh_perl
 	dh_compress

Modified: trunk/libgit-fastexport-perl/lib/Git/FastExport.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/lib/Git/FastExport.pm?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/lib/Git/FastExport.pm (original)
+++ trunk/libgit-fastexport-perl/lib/Git/FastExport.pm Wed Sep 24 17:29:46 2008
@@ -5,7 +5,7 @@
 use Cwd;
 use IPC::Open2;
 
-our $VERSION = '0.02';
+our $VERSION = '0.04';
 
 sub new {
     my ( $class, $repo ) = @_;

Modified: trunk/libgit-fastexport-perl/script/git-stitch-repo
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libgit-fastexport-perl/script/git-stitch-repo?rev=25592&op=diff
==============================================================================
--- trunk/libgit-fastexport-perl/script/git-stitch-repo (original)
+++ trunk/libgit-fastexport-perl/script/git-stitch-repo Wed Sep 24 17:29:46 2008
@@ -3,14 +3,17 @@
 use warnings;
 use Git;
 use Git::FastExport;
-
-our $VERSION = 0.02;
+use File::Spec::Functions qw( rel2abs );
+
+our $VERSION = '0.04';
 
 my %repo;
 
 # process command-line parameters
+my $name = 'A';
 while (@ARGV) {
     my ( $repo, $dir ) = split /:/, shift @ARGV, 2;
+    $repo = rel2abs($repo);
     $dir ||= '';
 
     # create an export parser for each repo
@@ -24,19 +27,20 @@
     $repo{$repo}{repo}   = $repo;
     $repo{$repo}{dir}    = $dir;
     $repo{$repo}{parser} = $parser;
+    $repo{$repo}{name}   = $dir || $name;
+    $name++;
 }
 
 # repositories that we will process
 my @repos = values %repo;
 
-my $mark = 1_000_000;    # mark counter in the new rpo
+my $mark = 1_000_000;    # mark counter in the new repo
 my %mark_map;            # map marks in source repos to marks in the new repo
 
 # get the first commits
 $_->{commit} = next_commit( $_->{parser} ) for @repos;
 
 # main loop
-use Data::Dumper;
 my $last;
 my %commits;
 while (@repos) {
@@ -81,6 +85,9 @@
         merge    => exists $commit->{merge},
     };
 
+    # mark our original source
+    $commit->{header} =~ s/$/-$repo->{name}/;
+
     # this commit's parents
     my @parents = map {/:(\d+)/g} @{ $commit->{from} || [] },
         @{ $commit->{merge} || [] };
@@ -99,7 +106,7 @@
 
     # update the parents information
     for my $parent ( map { $parent_map{$_} } @parents ) {
-        push @{ $commits{$parent}{children} }, $node;
+        push @{ $commits{$parent}{children} }, $node->{name};
     }
 
     # dump the commit
@@ -149,21 +156,24 @@
         return $node if ( !@{ $node->{children} } );
 
         # some children nodes are local
-        return $node if grep { $_->{repo} eq $repo } @{ $node->{children} };
+        return $node
+            if grep { $commits{$_}->{repo} eq $repo } @{ $node->{children} };
 
         # there's a child in the same branch
         if ( my ($peer)
-            = grep { $_->{branch} eq $branch } @{ $node->{children} } )
+            = grep { $commits{$_}->{branch} eq $branch }
+            @{ $node->{children} } )
         {
+
             # but don't go past another repo's merges
-            return $node if $peer->{merge};
-            $node = $peer;
+            # FIXME - unless it only includes ancestors of ours
+            return $node if $commits{$peer}->{merge};
+            $node = $commits{$peer};
         }
 
         # or pick the first child (as good as any)
         else {
-
-            $node = $node->{children}[0];
+            $node = $commits{ $node->{children}[0] };
         }
     }
 }
@@ -186,46 +196,81 @@
 a new repository containing all the commits in a new commit tree
 that respects the history of all the source repositories.
 
+Typical usage is like this:
+
+    $ ls
+    A  B
+    $ mkdir RESULT
+    $ cd RESULT
+    $ git-init
+    $ git-stitch-repo ../A:A ../B:B | git-fast-import
+
+The C<RESULT> repository will contain all commits from repositories A
+and B, with the files from A in subdirectory F<A/> and the files from
+B in subdirectory F<B/>.
+
+B<git-stich-repo> works perfectly with repositories that have a B<linear>
+history (no merges). It has successfully been tested with 16 linear
+repositories, and produced the expected result.
+
 =head2 Example
 
 Imagine we have two repositories A and B that we want to stitch into
 a repository C so that all the files from A are in subdirectory F<A>
 and all the files from B are in subdirectory F<B>.
 
+Note: in the following ASCII art graphs, horizontal order is chronological.
+
 Repository A:
 
-           topic
-           '     ,master
-           A3---A5
-          /    /
-    A1---A2---A4
+                topic
+                '    ,master
+          ,----A3---A5
+         /         /
+    A1--A2---A4---'
 
 Branch I<master> points to A5 and branch I<topic> points to A3.
 
 Repository B:
-                 ,topic    ,master
-           B3---B5---B7---B8
-          /         /
-    B1---B2---B4---B6
+
+                           ,topic    ,master
+           ,---------B3---B5---B7---B8
+          /                   /
+    B1---B2---B4---B6--------'
 
 Branch I<master> points to B8 and branch I<topic> points to B5.
 
-The C repository should preserve chronology, commit relationships and
+The RESULT repository should preserve chronology, commit relationships and
 branches as much as possible, while giving the impression that the
-directories F<A> & F<B> did live side-by-side all the time.
+directories F<A/> & F<B/> did live side-by-side all the time.
 
 Assuming additional timestamps not shown on the above graphs,
 B<git-stitch-repo> will produce a B<git-fast-import> stream that will
 create the following history:
 
-                                    ,topic    ,master
-                    A3---B3---A5---B5---B7---B8
-                   /         /         /
-   A1---B1---A2---B2---A4---B4--------B6
-
-
-Note that the current result is slightly buggy, since A5 wasn't on the
-I<topic> branch in the original graph for A.
+                                       ,topic-A
+                      ,---------------A3---B3 master-A
+                     /                      \ '    ,topic-B
+                    /         ,--------------A5---B5
+                   /         /                     \      ,master-B
+   A1---B1---A2---B2---A4---B4---B6-----------------B7---B8
+
+
+=head1 BUGS & IMPROVEMENTS
+
+Any mathematician will tell you there are many many ways to stitch two
+trees together. This programs tries very hard not to create inconsistent
+history with regard to each input repository.
+
+The current implementation can (and will be) improved. I'm very interested
+in test repositories that do not give the expected results.
+
+One of the issues is that we currently refuse to stitch a node after
+a merge from another repository. For the current example, that would
+mean that any commit having A5 as a parent would be attached to B5,
+and not to B8.
+
+Fixing this is in the TODO list.
 
 =head1 AUTHOR
 




More information about the Pkg-perl-cvs-commits mailing list