diff options
| author | axis <qt-info@nokia.com> | 2011-04-05 10:32:06 +0200 |
|---|---|---|
| committer | axis <qt-info@nokia.com> | 2011-04-05 10:32:06 +0200 |
| commit | 94782fea5d702b5564d5a17d7cbcf7010bd8b62e (patch) | |
| tree | 59ae466da82d48519e2877a53d0ef95a1f064748 | |
| parent | 1d80b49f931846677e990330d3d48a2e02f7c045 (diff) | |
Added the -zero-move-graft flag.
This rewrites the modularized repositories' histories so that the
resulting graft back to the old Qt history will not see any file
moves.
| -rwxr-xr-x | modularize | 12 | ||||
| -rw-r--r-- | scripts/905_git_split | 43 |
2 files changed, 49 insertions, 6 deletions
@@ -79,6 +79,7 @@ our $link_type = COPY; our $qtdir = getcwd(); our $qtVersion; our $isMaster = 1; +our $zeroMoveGraft = 0; my $regenerate_patches = 0; my $rebase_patches = 0; @@ -373,6 +374,9 @@ sub showUsage { print " -hardlinks Same as -symlinks, but uses hardlinks instead.\n"; print " You MOST LIKELY want to use this option, since symlinks\n"; print " will be resolved by qmake, and the actual location used.\n"; + print " -zero-move-graft Apply patches on the modularized repositories instead of the\n"; + print " old monolithic one, so that the graft will not see any file\n"; + print " moves (only works on Linux).\n"; print " -redo Resets (hard) the repo, and cleans up (-dffx)\n"; print " before running the scripts\n"; print " -experimental Ignore the set \"good\" SHA1 for the current branch, and\n"; @@ -428,6 +432,8 @@ while ( @ARGV ) { showUsage(); exit 1; } + } elsif ($arg eq "-zero-move-graft") { + $zeroMoveGraft = 1; } elsif ($arg eq "-experimental") { $good_sha1 = findSHA1Before($qtdir, "Commit of all changes done by the modularization script"); } elsif ($arg eq "-rebase-patches") { @@ -582,7 +588,11 @@ fsCopy("$basepath/files/qtxmlpatterns.pro", "qtxmlpatterns/"); if ($commit_changes) { print "Committing all changes done by the modularization script\n"; run("git add ."); - run("git commit -a -m \"Commit of all changes done by the modularization script\" -q"); + if ($zeroMoveGraft) { + run("git commit -a -F $basepath/misc/import-commit-msg --author \"Qt by Nokia <qt-info\@nokia.com>\" -q"); + } else { + run("git commit -a -m \"Commit of all changes done by the modularization script\" -q"); + } } # Run scripts that generate extra commits. diff --git a/scripts/905_git_split b/scripts/905_git_split index 16d3d69..42b91cc 100644 --- a/scripts/905_git_split +++ b/scripts/905_git_split @@ -52,11 +52,9 @@ if ($link_type != COPY) { } } -# do a full copy/symlink/hardlink of each module into the repo base -# and initialize the module repo there -foreach my $module (@repos) { - my $i = "$qtdir/$module"; - my $o = "$repos_base/$module"; +sub produceModule +{ + my ($module, $i, $o) = @_; if ($link_type == SYMLINKS) { print "Creating symlink from '$i' to '$o'\n"; @@ -74,6 +72,41 @@ foreach my $module (@repos) { run("git init . -q"); run("git add -f ."); run("git commit -F $basepath/misc/import-commit-msg --author \"Qt by Nokia <qt-info\@nokia.com>\" -q"); +} + +sub produceZeroMoveModule +{ + my ($module, $i, $o) = @_; + + print("Rewriting $module to have zero moves.\n"); + run("git checkout master"); + runNotDie("git branch -D zeroMoveGraft-temp") if (`git branch` =~ /zeroMoveGraft-temp/s); + + run("git checkout -b zeroMoveGraft-temp"); + run("git filter-branch -f --parent-filter 'read parent; if [ \"\$parent\" != \"-p $good_sha1\" ]; then echo \$parent; fi' --prune-empty --subdirectory-filter '$module' $good_sha1..zeroMoveGraft-temp"); + + ensureDir($o); + chdir($o); + run("git init . -q"); + run("git fetch $qtdir zeroMoveGraft-temp"); + run("git reset --hard FETCH_HEAD"); + chdir($qtdir); + + run("git checkout master"); + runNotDie("git branch -D zeroMoveGraft-temp"); +} + +# do a full copy/symlink/hardlink of each module into the repo base +# and initialize the module repo there +foreach my $module (@repos) { + my $i = "$qtdir/$module"; + my $o = "$repos_base/$module"; + + if ($zeroMoveGraft) { + produceZeroMoveModule($module, $i, $o); + } else { + produceModule($module, $i, $o); + } # push modules to the server if ($run_push) { |
