[MediaWiki-commits] [Gerrit] Add a script to rebase changes from prior phpcs standards - change (mediawiki...code-utils)

2016-03-09 Thread Tim Starling (Code Review)
Tim Starling has submitted this change and it was merged.

Change subject: Add a script to rebase changes from prior phpcs standards
..


Add a script to rebase changes from prior phpcs standards

Change-Id: I73fef6fa3da84ed26c76ca8f545e0a1283bd3086
---
A rebase-long-array
1 file changed, 56 insertions(+), 0 deletions(-)

Approvals:
  Tim Starling: Verified; Looks good to me, approved



diff --git a/rebase-long-array b/rebase-long-array
new file mode 100755
index 000..10657a8
--- /dev/null
+++ b/rebase-long-array
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -e
+
+# Configuration
+
+SOURCE_DIR="$MW_INSTALL_PATH"
+WORK_BRANCH="$1"
+MASTER_BRANCH=master
+SCHROOT_PREFIX=
+SCHROOT_OVERLAY=
+
+# End configuration
+
+function fix_source() {
+   $SCHROOT_PREFIX vendor/bin/phpcbf $FILES \
+   || true # phpcbf returns 1 when it fixes things
+   if [ -n "$SCHROOT_OVERLAY" ]; then
+   for f in $FILES; do
+   mv -v "$SCHROOT_OVERLAY/$f" "$SOURCE_DIR/$f"
+   done
+   fi
+}
+
+cd "$SOURCE_DIR"
+git checkout "$WORK_BRANCH"
+
+FILES=$(git diff-tree -r --name-only HEAD^ HEAD)
+UNFIXED_WORK=$(git rev-parse "$WORK_BRANCH")
+
+echo "Trying to fix $UNFIXED_WORK"
+
+# Generate fixed base commit
+
+git checkout "$WORK_BRANCH"^
+fix_source
+git commit -a -m "Temporary commit: fixed base"
+FIXED_BASE=$(git rev-parse HEAD)
+
+# Generate fixed work commit
+git checkout "$UNFIXED_WORK"
+fix_source
+git commit -a -m "Temporary commit: fixed work"
+FIXED_WORK=$(git rev-parse HEAD)
+
+# Reset the work branch to master
+git checkout "$WORK_BRANCH"
+git reset --hard "$MASTER_BRANCH"
+
+# Synthesize a commit on top of it, with conflict markers 
+git diff "$FIXED_BASE" "$FIXED_WORK" | git apply --index -3 || true
+
+# Write the old commit message to MERGE_MSG so that it will be used as the 
default commit message
+git log -1 "$UNFIXED_WORK" --format=%B > .git/MERGE_MSG
+
+echo "Done. Type \"git commit\" when ready."

-- 
To view, visit https://gerrit.wikimedia.org/r/276095
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I73fef6fa3da84ed26c76ca8f545e0a1283bd3086
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/code-utils
Gerrit-Branch: master
Gerrit-Owner: Tim Starling 
Gerrit-Reviewer: Bartosz DziewoƄski 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Tim Starling 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add a script to rebase changes from prior phpcs standards - change (mediawiki...code-utils)

2016-03-08 Thread Tim Starling (Code Review)
Tim Starling has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/276095

Change subject: Add a script to rebase changes from prior phpcs standards
..

Add a script to rebase changes from prior phpcs standards

Change-Id: I73fef6fa3da84ed26c76ca8f545e0a1283bd3086
---
A rebase-long-array
1 file changed, 56 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/code-utils 
refs/changes/95/276095/1

diff --git a/rebase-long-array b/rebase-long-array
new file mode 100755
index 000..10657a8
--- /dev/null
+++ b/rebase-long-array
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+set -e
+
+# Configuration
+
+SOURCE_DIR="$MW_INSTALL_PATH"
+WORK_BRANCH="$1"
+MASTER_BRANCH=master
+SCHROOT_PREFIX=
+SCHROOT_OVERLAY=
+
+# End configuration
+
+function fix_source() {
+   $SCHROOT_PREFIX vendor/bin/phpcbf $FILES \
+   || true # phpcbf returns 1 when it fixes things
+   if [ -n "$SCHROOT_OVERLAY" ]; then
+   for f in $FILES; do
+   mv -v "$SCHROOT_OVERLAY/$f" "$SOURCE_DIR/$f"
+   done
+   fi
+}
+
+cd "$SOURCE_DIR"
+git checkout "$WORK_BRANCH"
+
+FILES=$(git diff-tree -r --name-only HEAD^ HEAD)
+UNFIXED_WORK=$(git rev-parse "$WORK_BRANCH")
+
+echo "Trying to fix $UNFIXED_WORK"
+
+# Generate fixed base commit
+
+git checkout "$WORK_BRANCH"^
+fix_source
+git commit -a -m "Temporary commit: fixed base"
+FIXED_BASE=$(git rev-parse HEAD)
+
+# Generate fixed work commit
+git checkout "$UNFIXED_WORK"
+fix_source
+git commit -a -m "Temporary commit: fixed work"
+FIXED_WORK=$(git rev-parse HEAD)
+
+# Reset the work branch to master
+git checkout "$WORK_BRANCH"
+git reset --hard "$MASTER_BRANCH"
+
+# Synthesize a commit on top of it, with conflict markers 
+git diff "$FIXED_BASE" "$FIXED_WORK" | git apply --index -3 || true
+
+# Write the old commit message to MERGE_MSG so that it will be used as the 
default commit message
+git log -1 "$UNFIXED_WORK" --format=%B > .git/MERGE_MSG
+
+echo "Done. Type \"git commit\" when ready."

-- 
To view, visit https://gerrit.wikimedia.org/r/276095
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73fef6fa3da84ed26c76ca8f545e0a1283bd3086
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/code-utils
Gerrit-Branch: master
Gerrit-Owner: Tim Starling 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits