Better upstream (SVN) branches
PMeira opened this issue · 6 comments
Currently, all the source code is imported via git svn
to a branch named opendss-official-svn
, as documented in https://github.com/dss-extensions/dss_capi/blob/5969d756faeafcc2c181548ad276d1e039484035/docs/upstream_branch.md
Since OpenDSS version 8+ (folder Version8
) is the main implementation, it might be useful to import the two folders Version8
and Version7
into two separate branches here, e.g. opendss-official-svn-v8
and opendss-official-svn-v7
.
Besides that, since OpenDSS on SourceForge is a monorepo which includes every single file (docs, binaries, etc.), a lot of commits result in empty changesets when we import here. Filtering out those empty branches would be useful (currently I do that temporarily in my local copy).
Something similar could be done for the dss-extensions/electricdss-tst repo.
Pushed the two branches to test the idea. Still want to try adjusting git svn
directly later. For now, this was done with:
git checkout opendss-official-svn
git branch opendss-official-svn-v7
git branch opendss-official-svn-v8
git checkout opendss-official-svn-v7
git filter-branch --subdirectory-filter Version7 --prune-empty -f
git filter-branch --tree-filter 'rm -rf Source/CMD_Lazz Source/DDLL Version7/Source/CMD_Lazz Version7/Source/DDLL Version8/Source/CMD_Lazz Version8/Source/DDLL Source/CMD' --prune-empty -f
git checkout opendss-official-svn-v8
git filter-branch --subdirectory-filter Version8 --prune-empty -f
git filter-branch --tree-filter 'rm -rf Source/CMD_Lazz Source/DDLL Version7/Source/CMD_Lazz Version7/Source/DDLL Version8/Source/CMD_Lazz Version8/Source/DDLL Source/CMD' --prune-empty -f
git push -u github opendss-official-svn-v7
git push -u github opendss-official-svn-v8
It seems to work fine: https://github.com/dss-extensions/dss_capi/commits/opendss-official-svn-v8
This will help comparing the implementations and generating the changelog.
One related idea: since some commits only change formatting, try to apply a code formatting tool (likely a variation of JCF) to keep a canonical copy of each file. It seems JCF (JEDI Code Format) is integrated with Lazarus, and I found this repo (maybe not up-to-date) of a CLI tool based on that: https://github.com/git-bee/jcf-cli
If the tool still works, the idea is feasible.
Hm... JCF indeed works. The version from Lazarus doesn't seem to include extras, I got the same issues with some .pas
files as before. I don't see the need for that JCF-CLI version, maybe it was useful in the past.
We could add the JCF binary to the current Docker image...
Probably can close now. I added an extra folder to the filter to reduce the noise and there haven't been too many commits.
In the past 6 months, there were around 60 commits to the filtered SVN repo, so it's fine to do the process manually when required. Of those, 25 were related to the CIM export, 8 were actions like version string or README updates, and several other commits simply do not apply to us anymore since the property system was rewritten. A handful of the remaining were related to bug fixes, and many of the rest are features under development (e.g. DynamicExp.pas
).
Oh, and JCF doesn't correctly reformat many of the files.
Update: since v7 is retired and we will support the official OpenDSSDirect.DLL (DDLL subfolder), some tweaks, assuming Linux:
git checkout opendss-official-svn
git branch -D opendss-official-svn-v8
git branch opendss-official-svn-v8
git checkout opendss-official-svn-v8
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --subdirectory-filter Version8 --prune-empty -f
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --tree-filter 'rm -rf Source/CMD_Lazz Version7/Source/CMD_Lazz Version8/Source/CMD_Lazz Source/CMD Source/CommandLine Version8/Source/CommandLine Version7/Source/CommandLine Source/EXE Version8/Source/EXE Version7/Source/EXE Source/Forms Version8/Source/Forms Version7/Source/Forms Source/ProgressEXE Version8/Source/ProgressEXE Source/epiktimer Version8/Source/epiktimer Source/ParallelLib Version8/Source/ParallelLib' --prune-empty -f
# fix some files with mixed line-endings
find ./ -name '*.pas' -exec sed -i 's/\r\n/\n/g' {} \;
# apply JCF
#...
git add Source JCFSettings.cfg
git commit -m "Reformat code"
git push --force-with-lease -u github opendss-official-svn-v8