#!/bin/bash set -u # Usage: # ./repro.sh [-f] 2>&1 | tee log export P4CONFIG=.p4config export P4ENVIRO=/dev/null/.p4enviro declare Version=1.0.8 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 -C0 -n" 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 "\nDelete Two.h directly in main." p4 delete Two.h && p4 submit -d "Delete 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." p4 stream -o //stream/r1|sed s:main:r2:g|p4 stream -i 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 -as" msg "\nUh oh, the resolve was skipped, leaving it for manual resolution." msg "\nWorkaround: Resolving with -ay ..." cmd "p4 resolve -ay Two.h" msg "\nOK, that worked, but the 'p4 resolve -as' should have done that for me." msg "\nSubmitting ..." p4 submit -d "Merged r1 -> r2. Manual resolve was required." msg "\n== Another Bug Fix in r1 ==" msg "Make more changes in r1." cmd "p4 switch r1" cmd "p4 switch" msg "\nLet's try again. Updating One.h and Two.h in r1." cmd "p4 edit One.h Two.h" sed 's:Stuff:Things:g' One.h > NEW mv -f NEW One.h sed 's:Stuff:Things:g' Two.h > NEW mv -f NEW Two.h msg "\nSubmitting ..." p4 submit -d "Updated One.h and Two.h in r1 again." msg "\n== Merging r1 to r2 ==" p4 switch r2 p4 switch msg "\nMerging ..." cmd "p4 merge -S r1" msg "\nResolving with -as ..." cmd "p4 resolve -as" msg "\nHere I was hoping that, after having done 'resolve -ay' workaround once and submitted,\nit would at least remmeber for next time. But alas, no, the resolve is still skipped requring manual resolution." msg "\nWorkaround: Resolving with -ay ..." cmd "p4 resolve -ay Two.h" msg "\nSubmitting ..." p4 submit -d "Merged r1 -> r2. Manual resolve was required." msg "\nNow this looks silly -- all deletes:" cmd "p4 filelog //stream/r2/Two.h" msg "\nThe deletion recorded as #1 (by 'p4 populate' with '-f') makes perfect sense, capturing the intent." msg "But why the need to re-resolve with '-y' each time?"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 27790 | C. Thomas Tyler | Added test working with dm.resolve.ignoredeleted. | ||
#3 | 27789 | C. Thomas Tyler | Enhancned repro.sh script. | ||
#2 | 26931 | C. Thomas Tyler |
Updated 'p4 init' to add flags: -C0 -n Updated log with modern p4d version. |
||
#1 | 18682 | C. Thomas Tyler | Added repro script and log. |