#!/bin/bash #------------------------------------------------------------------------------ # Repro for: job085992 set -u # Usage: # ./repro.sh [-f] 2>&1 | tee log export P4CONFIG=.p4config export P4ENVIRO=/dev/null/.p4enviro declare Version=1.0.2 # Micro functions. function msg () { echo -e "${1:-Hi}"; } function bail () { msg "Error: ${1:-Unknown Error}"; exit ${2:-1}; } function cmd () { msg "${2:-Executing command: $1}"; $1; return $?; } ReproDir=/tmp/repro msg "Started ${0##*/} v$Version at $(date)." msg "ReproDir=$ReproDir" [[ -d $ReproDir && ${1:-Unset} == -f ]] && /bin/rm -rf "$ReproDir" [[ -d $ReproDir ]] && bail "Old repro dir [$ReproDir] exists." mkdir $ReproDir cd $ReproDir msg "\nPreliminary info: Show versions of p4/p4d on the PATH:" cmd "p4 -V" cmd "p4d -V" msg "\nPreliminary setup: Spin up a local repo." cmd "p4 init" echo -e "// ONE_H\n#ifndef ONE_H\n#define ONE_H 1\n\n//Stuff goes here\n\n#endif //ONE_H\n" > One.h echo -e "// TWO_H\n#ifndef TWO_H\n#define TWO_H 1\n\n//Stuff goes here\n\n#endif //TWO_H\n" > Two.h cmd "p4 status" msg "Reconcile and submit." p4 rec && p4 submit -d "Added One.h and Two.h in main." msg "\n== Release r1 ==" p4 stream -t release -P //stream/main -o //stream/r1 | p4 stream -i cmd "p4 populate -f -r -S //stream/r1" msg "\nRename Two.h directly in main." p4 edit Two.h && p4 move Two.h TheNumberTwo.h && p4 submit -d "Rename Two.h in main." msg "\n== Release r2 ==" p4 stream -t release -P //stream/main -o //stream/r2 | p4 stream -i cmd "p4 populate -f -r -S //stream/r2" msg "\nReparent flow of change to: r1 --> r2 --> main." msg "This is follow the best practice North of Main merge flow. That means the flow of change for release streams (North of Main, as opposed to development branches that live South of Main), should be managed such that changes flow from older branches to newer ones, to newer, and finally to main. The basic idea is that merge should Laura Wingerd's Google Talk from 2006 reinforces this. Listen to the section from 24:40 – 27:15: http://www.youtube.com/watch?v=AJ-CpGsCpM0 Laura recommends the oldest-to-newest merging model and does a nice job explaining the rationale for it.\n" p4 stream -o //stream/r1|sed s:main:r2:g|p4 stream -i cmd "p4 stream -o //stream/r1" msg "\n== Bug Fix in r1 ==" msg "Make changes in r1." p4 switch r1 p4 switch msg "\nUpdating One.h and Two.h in r1." cmd "p4 edit One.h Two.h" sed 's:Stuff:Cool Stuff:g' One.h > NEW mv -f NEW One.h sed 's:Stuff:Cool Stuff:g' Two.h > NEW mv -f NEW Two.h msg "\nSubmitting ..." p4 submit -d "Updated One.h and Two.h in r1." msg "\n== Merging r1 to r2 ==" cmd "p4 switch r2" cmd "p4 switch" msg "\nMerging ..." cmd "p4 merge -S r1" msg "\nResolving with -as ..." cmd "p4 resolve -am" msg "\nUh oh, it lost track of renames, and created an extra file, and" msg "not getting the content to the correct target file. The desired" msg "behaviour when doing 'p4 resolve -am' would be that content from" msg "//stream/r1/Two.h#2 would be propagated to //stream/r2/TheNumberTwo.h.\n" exit 0
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 19482 | C. Thomas Tyler | Updated to repro.sh v1.1.2, adding sample MoveTracker.sh. | ||
#5 | 19286 | C. Thomas Tyler |
Added Scenario 5, Move tracking via branch spec, including re-usable StreamMoveTracker.sh script. Added env.sh with convenience alias. Reran test suite to capture slight output normalization tweaks. Removed '-i' flag for toying with dm.integ.tweaks, as it has no effect on the given repro scenarios. |
||
#4 | 19088 | C. Thomas Tyler |
Added Scenario 4, The "North of Main" Populate/Copy Overlay Strategy, which works around the problem. |
||
#3 | 18865 | C. Thomas Tyler |
Added Scenario 1 and 2. Both are broken in different ways. |
||
#2 | 18864 | C. Thomas Tyler | Added job ref. | ||
#1 | 18862 | C. Thomas Tyler | Added repro. |