OSDN Git Service

Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Wed, 10 Dec 2008 06:41:27 +0000 (22:41 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Dec 2008 06:41:27 +0000 (22:41 -0800)
* maint:
  work around Python warnings from AsciiDoc
  git-svn: Make following parents atomic

Documentation/user-manual.txt
git-svn.perl
t/t9104-git-svn-follow-parent.sh

index 9f527d3..d4b1e90 100644 (file)
@@ -13,7 +13,7 @@ to build and test a particular version of a software project, search for
 regressions, and so on.
 
 People needing to do actual development will also want to read
-<<Developing-with-git>> and <<sharing-development>>.
+<<Developing-With-git>> and <<sharing-development>>.
 
 Further chapters cover more specialized topics.
 
@@ -399,7 +399,7 @@ the order it uses to decide which to choose when there are multiple
 references with the same shorthand name, see the "SPECIFYING
 REVISIONS" section of linkgit:git-rev-parse[1].
 
-[[Updating-a-repository-with-git-fetch]]
+[[Updating-a-repository-With-git-fetch]]
 Updating a repository with git-fetch
 ------------------------------------
 
@@ -955,7 +955,7 @@ echo "git diff --stat --summary -M v$last v$new > ../diffstat-$new"
 and then he just cut-and-pastes the output commands after verifying that
 they look OK.
 
-[[Finding-comments-with-given-content]]
+[[Finding-comments-With-given-Content]]
 Finding commits referencing a file with given content
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -972,7 +972,7 @@ Figuring out why this works is left as an exercise to the (advanced)
 student.  The linkgit:git-log[1], linkgit:git-diff-tree[1], and
 linkgit:git-hash-object[1] man pages may prove helpful.
 
-[[Developing-with-git]]
+[[Developing-With-git]]
 Developing with git
 ===================
 
@@ -1675,7 +1675,7 @@ dangling objects can arise in other situations.
 Sharing development with others
 ===============================
 
-[[getting-updates-with-git-pull]]
+[[getting-updates-With-git-pull]]
 Getting updates with git-pull
 -----------------------------
 
@@ -1683,7 +1683,7 @@ After you clone a repository and make a few changes of your own, you
 may wish to check the original repository for updates and merge them
 into your own work.
 
-We have already seen <<Updating-a-repository-with-git-fetch,how to
+We have already seen <<Updating-a-repository-With-git-fetch,how to
 keep remote tracking branches up to date>> with linkgit:git-fetch[1],
 and how to merge two branches.  So you can merge in changes from the
 original repository's master branch with:
@@ -1794,7 +1794,7 @@ Public git repositories
 
 Another way to submit changes to a project is to tell the maintainer
 of that project to pull the changes from your repository using
-linkgit:git-pull[1].  In the section "<<getting-updates-with-git-pull,
+linkgit:git-pull[1].  In the section "<<getting-updates-With-git-pull,
 Getting updates with git-pull>>" we described this as a way to get
 updates from the "main" repository, but it works just as well in the
 other direction.
@@ -2004,7 +2004,7 @@ $ git push ssh://yourserver.com/~you/proj.git +master
 Normally whenever a branch head in a public repository is modified, it
 is modified to point to a descendant of the commit that it pointed to
 before.  By forcing a push in this situation, you break that convention.
-(See <<problems-with-rewriting-history>>.)
+(See <<problems-With-rewriting-history>>.)
 
 Nevertheless, this is a common practice for people that need a simple
 way to publish a work-in-progress patch series, and it is an acceptable
@@ -2573,7 +2573,7 @@ There are numerous other tools, such as StGIT, which exist for the
 purpose of maintaining a patch series.  These are outside of the scope of
 this manual.
 
-[[problems-with-rewriting-history]]
+[[problems-With-rewriting-history]]
 Problems with rewriting history
 -------------------------------
 
index e64e97b..2c206e9 100755 (executable)
@@ -2403,12 +2403,20 @@ sub find_parent_branch {
                $gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1);
        }
        my ($r0, $parent) = $gs->find_rev_before($r, 1);
-       if (!defined $r0 || !defined $parent) {
-               my ($base, $head) = parse_revision_argument(0, $r);
-               if ($base <= $r) {
+       {
+               my ($base, $head);
+               if (!defined $r0 || !defined $parent) {
+                       ($base, $head) = parse_revision_argument(0, $r);
+               } else {
+                       if ($r0 < $r) {
+                               $gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,
+                                       0, 1, sub { $base = $_[1] - 1 });
+                       }
+               }
+               if (defined $base && $base <= $r) {
                        $gs->fetch($base, $r);
                }
-               ($r0, $parent) = $gs->last_rev_commit;
+               ($r0, $parent) = $gs->find_rev_before($r, 1);
        }
        if (defined $r0 && defined $parent) {
                print STDERR "Found branch parent: ($self->{ref_id}) $parent\n";
index 0a091e0..ab9fa32 100755 (executable)
@@ -149,6 +149,48 @@ test_expect_success "track initial change if it was only made to parent" '
             "`git rev-parse r9270-d~1`"
        '
 
+test_expect_success "follow-parent is atomic" '
+       (
+               cd wc &&
+               svn up &&
+               svn mkdir stunk &&
+               echo "trunk stunk" > stunk/readme &&
+               svn add stunk/readme &&
+               svn ci -m "trunk stunk" &&
+               echo "stunk like junk" >> stunk/readme &&
+               svn ci -m "really stunk" &&
+               echo "stink stank stunk" >> stunk/readme &&
+               svn ci -m "even the grinch agrees"
+       ) &&
+       svn copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
+       { svn cp -m "early stunk flunked too" \
+               "$svnrepo"/stunk@17 "$svnrepo"/flunked ||
+       svn cp -m "early stunk flunked too" \
+               -r17 "$svnrepo"/stunk "$svnrepo"/flunked; } &&
+       git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
+       git svn fetch -i stunk &&
+       git update-ref refs/remotes/flunk@18 refs/remotes/stunk~2 &&
+       git update-ref -d refs/remotes/stunk &&
+       git config --unset svn-remote.svn.fetch stunk &&
+       mkdir -p "$GIT_DIR"/svn/flunk@18 &&
+       rev_map=$(cd "$GIT_DIR"/svn/stunk && ls .rev_map*) &&
+       dd if="$GIT_DIR"/svn/stunk/$rev_map \
+          of="$GIT_DIR"/svn/flunk@18/$rev_map bs=24 count=1 &&
+       rm -rf "$GIT_DIR"/svn/stunk &&
+       git svn init --minimize-url -i flunk "$svnrepo"/flunk &&
+       git svn fetch -i flunk &&
+       git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
+       git svn fetch -i stunk &&
+       git svn init --minimize-url -i flunked "$svnrepo"/flunked &&
+       git svn fetch -i flunked
+       test "`git rev-parse --verify refs/remotes/flunk@18`" \
+          = "`git rev-parse --verify refs/remotes/stunk`" &&
+       test "`git rev-parse --verify refs/remotes/flunk~1`" \
+          = "`git rev-parse --verify refs/remotes/stunk`" &&
+       test "`git rev-parse --verify refs/remotes/flunked~1`" \
+          = "`git rev-parse --verify refs/remotes/stunk~1`"
+       '
+
 test_expect_success "track multi-parent paths" '
        svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
        git svn multi-fetch &&