From d19d8568f1b29dd62c9f1385b5e6bcd508f2b83c Mon Sep 17 00:00:00 2001 From: Peter Donis Date: Fri, 11 Mar 2016 18:44:33 -0500 Subject: [PATCH 1/4] Add user spoofing to be2 extractor test. --- test/be2.fi | 24 ++++++++++++------------ test/hg-be2-test | 14 ++++++++------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/test/be2.fi b/test/be2.fi index c16ac0668..9c3ddf137 100644 --- a/test/be2.fi +++ b/test/be2.fi @@ -6,8 +6,8 @@ Test file 1. reset refs/heads/master commit refs/heads/master mark :2 -author Eric S. Raymond 1456976347 -0500 -committer Eric S. Raymond 1456976347 -0500 +author "J. Random Hacker" 1456976347 -0500 +committer "J. Random Hacker" 1456976347 -0500 data 20 Commit test file 1. M 100644 :1 testfile1 @@ -19,8 +19,8 @@ Test file 2. commit refs/heads/test mark :4 -author Eric S. Raymond 1456976408 -0500 -committer Eric S. Raymond 1456976408 -0500 +author "J. Random Hacker" 1456976408 -0500 +committer "J. Random Hacker" 1456976408 -0500 data 20 Commit test file 2. from :2 @@ -33,8 +33,8 @@ Test file 3. commit refs/heads/master mark :6 -author Eric S. Raymond 1456976475 -0500 -committer Eric S. Raymond 1456976475 -0500 +author "J. Random Hacker" 1456976475 -0500 +committer "J. Random Hacker" 1456976475 -0500 data 20 Commit test file 3. from :2 @@ -42,8 +42,8 @@ M 100644 :5 testfile3 commit refs/heads/master mark :7 -author Eric S. Raymond 1456976606 -0500 -committer Eric S. Raymond 1456976606 -0500 +author "J. Random Hacker" 1456976606 -0500 +committer "J. Random Hacker" 1456976606 -0500 data 19 Merge test branch. from :6 @@ -57,8 +57,8 @@ Test file 4. commit refs/heads/test mark :9 -author Eric S. Raymond 1456976715 -0500 -committer Eric S. Raymond 1456976715 -0500 +author "J. Random Hacker" 1456976715 -0500 +committer "J. Random Hacker" 1456976715 -0500 data 20 Commit test file 4. from :4 @@ -71,8 +71,8 @@ Test file 5. commit refs/heads/master mark :11 -author Eric S. Raymond 1456976798 -0500 -committer Eric S. Raymond 1456976798 -0500 +author "J. Random Hacker" 1456976798 -0500 +committer "J. Random Hacker" 1456976798 -0500 data 20 Commit test file 5. from :7 diff --git a/test/hg-be2-test b/test/hg-be2-test index 3c3c1b96e..654aa8065 100755 --- a/test/hg-be2-test +++ b/test/hg-be2-test @@ -31,6 +31,8 @@ shift $(($OPTIND - 1)) testrepo=${1:-/tmp/test-repo} +USER='"J. Random Hacker" ' + # Should we build the repo? if [ $build = True ] then @@ -46,25 +48,25 @@ then ( try echo "Test file 1." > testfile1 try hg add testfile1 >/dev/null - try hg commit --date "1456976347 18000" -m "Commit test file 1." >/dev/null + try hg commit --user "$USER" --date "1456976347 18000" -m "Commit test file 1." >/dev/null try hg branch test >/dev/null try echo "Test file 2." > testfile2 try hg add testfile2 >/dev/null - try hg commit --date "1456976408 18000" -m "Commit test file 2." >/dev/null + try hg commit --user "$USER" --date "1456976408 18000" -m "Commit test file 2." >/dev/null try hg update default >/dev/null try echo "Test file 3." > testfile3 try hg add testfile3 >/dev/null - try hg commit --date "1456976475 18000" -m "Commit test file 3." >/dev/null + try hg commit --user "$USER" --date "1456976475 18000" -m "Commit test file 3." >/dev/null try hg merge test >/dev/null - try hg commit --date "1456976606 18000" -m "Merge test branch." >/dev/null + try hg commit --user "$USER" --date "1456976606 18000" -m "Merge test branch." >/dev/null try hg update test >/dev/null try echo "Test file 4." > testfile4 try hg add testfile4 >/dev/null - try hg commit --date "1456976715 18000" -m "Commit test file 4." >/dev/null + try hg commit --user "$USER" --date "1456976715 18000" -m "Commit test file 4." >/dev/null try hg update default >/dev/null try echo "Test file 5." > testfile5 try hg add testfile5 >/dev/null - try hg commit --date "1456976798 18000" -m "Commit test file 5." >/dev/null + try hg commit --user "$USER" --date "1456976798 18000" -m "Commit test file 5." >/dev/null ) || exit 1 try cd - >/dev/null fi -- GitLab From ba8357679efce5da810b56c7f042e02970ca1969 Mon Sep 17 00:00:00 2001 From: Peter Donis Date: Fri, 11 Mar 2016 18:44:55 -0500 Subject: [PATCH 2/4] Re-enable be2 in git extractor test. --- test/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Makefile b/test/Makefile index eb5998ba2..b8bad28ea 100644 --- a/test/Makefile +++ b/test/Makefile @@ -133,8 +133,7 @@ coalesce: @rm -f /tmp/regress # Test the git extractor -# FIXME: be2 should work here too - might be git's nondeterminism problem again. -GITLOADS = bs be +GITLOADS = bs be be2 git-regress: @echo "=== Testing git-extractor:" @if command -v git >/dev/null 2>&1 ; \ -- GitLab From 5f428dd4221f3a81a6c951c9f14fcf1c98e6fc83 Mon Sep 17 00:00:00 2001 From: Peter Donis Date: Fri, 11 Mar 2016 21:20:00 -0500 Subject: [PATCH 3/4] Resets at end of extractor run are now appended in commit mark order. --- reposurgeon | 2 +- test/be2.fi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reposurgeon b/reposurgeon index 7a144f07e..12ac827b8 100755 --- a/reposurgeon +++ b/reposurgeon @@ -3086,7 +3086,7 @@ class RepoStreamer: repo.addEvent(commit) # Now append reset objects for (resetname, revision) in sorted(self.extractor.iter_resets(), - key=operator.itemgetter(1)): + key=lambda item: int(self.commit_map[item[1]].mark[1:])): # FIXME: what if revision is unknown ? keep previous behavior for now reset = Reset(repo, target=self.commit_map[revision]) reset.ref = resetname diff --git a/test/be2.fi b/test/be2.fi index 9c3ddf137..1164b3b90 100644 --- a/test/be2.fi +++ b/test/be2.fi @@ -78,9 +78,9 @@ Commit test file 5. from :7 M 100644 :10 testfile5 -reset refs/heads/master -from :11 - reset refs/heads/test from :9 +reset refs/heads/master +from :11 + -- GitLab From 2b3a1655f17d5cce8f95b7d58109637cac4e6388 Mon Sep 17 00:00:00 2001 From: Peter Donis Date: Fri, 11 Mar 2016 21:23:57 -0500 Subject: [PATCH 4/4] Add comment on sorting of resets at end of extractor run. --- reposurgeon | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reposurgeon b/reposurgeon index 12ac827b8..4bda99f18 100755 --- a/reposurgeon +++ b/reposurgeon @@ -3085,6 +3085,8 @@ class RepoStreamer: announce("r%s: gets mark %s (%d ops)" % (revision, commit.mark, len(commit.operations()))) repo.addEvent(commit) # Now append reset objects + # Note: we sort the resets by the mark number of their associated revisions; this + # is to ensure that the ordering is (a) deterministic, and (b) easily understood. for (resetname, revision) in sorted(self.extractor.iter_resets(), key=lambda item: int(self.commit_map[item[1]].mark[1:])): # FIXME: what if revision is unknown ? keep previous behavior for now -- GitLab