#!/bin/bash set -u # Usage: # ./repro.sh [-f] 2>&1 | tee log export P4CONFIG=.p4config export P4ENVIRO=/dev/null/.p4enviro declare Version=1.2.0 declare P4DMajorVersion= 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" P4DMajorVersion="$(p4d -V | grep '^Rev\.' | cut -d '/' -f 3)" [[ -n "$P4DMajorVersion" ]] || bail "Could not determine p4d major version." 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 "\nResolving with -n to see if there is more to do ..." cmd "p4 resolve -n" msg "\nUh oh, the resolve was skipped, leaving it for manual resolution." if [[ "$P4DMajorVersion" < "2021.1" ]]; then msg "\nP4D version major is $P4DMajorVersion. Try with p4d 2021.1 to try setting dm.resolve.ignoredeleted feature (new in 2021.1).\n" exit 0 fi msg "\nResetting to see how it goes with p4d 2021.1 with dm.resolve.ignoredeleted." cmd "p4 revert //stream/r2/..." cmd "p4 configure set dm.resolve.ignoredeleted=1" msg "\nMerging ..." cmd "p4 merge -S r1" msg "\nResolving with -as ..." cmd "p4 resolve -as" msg "\nResolving with -n to see if there is more to do ..." cmd "p4 resolve -n" msg "\nOK! That looks good! Now let's confirm that things were resolved correctly." cmd "p4 opened" msg "\nNote that Two.h is opened for delte in the target as #1, even though it never exited there."
# | 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. |