Closed AronGahagan closed 5 years ago
Bash/git/grep/sed...incredible. Did this for all .bas, frm, and .cls files in both the root and all subdirectories with a single line of code*:
git grep -l err\) | xargs sed -i 's/err)/err, Erl)/g'
HT: https://blog.jasonmeridth.com/posts/use-git-grep-to-replace-strings-in-files-in-your-git-repository/
todo:
git grep -l Erl
- to list all files with Erl
git grep -l Erl | xargs egrep -r -a -n -i ^\'\<cpt_version
- to list cpt_versions of those filesCurrentVersions.xml
When merging, be sure to ignore whitespace errors (sed created one on every line):
git merge -Xignore-space-change
HT: https://stackoverflow.com/questions/9776527/merging-without-whitespace-conflicts
Celebrated too soon. Evidently running sed
with the -i
switch (edit inline) messed with the LF
vs. CRLF
(or something) in the UserForm modules, and VBA no longer recognizes them as forms, tripping an error. Continuing testing.
Tried running git add --renormalize
. When using File > Import... from the VBE it appears to work; but running cptUpgrades_frm does not. Used File > Import to pull in the issue51-addErl branch, and the VBE recognized them fine. Then ran my gitVBA export tool, assuming that because VBE recognized them something was 'fixed.' All modules were modified. Then committed and pushed. Then tried to re-run the Upgrades and they still were not recognized.
Everything was fine until I ran the sed -i
operation which likely changed line endings. When I added those modified files, I got the CRLF to LF warnings since I have core.autocrlf true
. Maybe if I start over from the beginning and set core.autocrlf false
it will work.
FMI: https://lostechies.com/keithdahlby/2011/04/06/windows-git-tip-hide-carriage-return-in-diff/
Confirmed: sed -i
actually creates a new file and then renames it after the operation completes; which means the Windows line feeds CR+LF
are replaced with something unrecognizable by the VBE.
Instead will try perl -pi -e 's/err\)/err, Erl\)/g'
and run it against *.bas, *.cls, *.frm */*.bas, */*.frm, */*.cls
. Running it with core.autocrlf false
. This edits the original file unlike sed -i
, and keeps CRLF
unchanged. (credit)
...success. All versions bumped and ready to merge into master
.
Holding off on merge/push into master until I'm not travelling in case there's a problem.
Request
Globally add optional
Erl
to all calls tocptHandleErr
. If line numbers are enabled, the error message will include the Erl (Error reference line?). If there is no error, then Erl returns0
and the subcptHandleErr()
will ignore it.Suggestion
Todo:
develop
and createtopic
branchissueXX
topic
intodevelop
and pushdevelop
intomaster
and push