-
Notifications
You must be signed in to change notification settings - Fork 748
Implementation of multiple revisions without revisions map #6620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: add/mult_revisions_jun_revision_map
Are you sure you want to change the base?
Conversation
…lones of the same commit Signed-off-by: jorgee <[email protected]>
|
Find bellow the directory tree for a project with the bare repo and two revisions (commit 451ebdand and master branch).
|
pditommaso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can briefly summarise what's the benefits of this approach vs revisions map ?
| List<AssetManager> dropList = [] | ||
| if ( allRevisions ) { | ||
| def revManager = new AssetManager(args[0]) | ||
| revManager.listRevisions().each { rev -> | ||
| if( rev == DEFAULT_REVISION_DIRNAME ) | ||
| rev = null | ||
| if( !revManager.localRootPath.exists() ) { | ||
| throw new AbortOperationException("No match found for: ${revManager.getProjectWithRevision()}") | ||
| } | ||
| revManager.listCommits().each { rev -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try reducing the cyclomatic complexity of this method, splitting in smaller self-describing private methods.
| if( moreDetailed ) | ||
| detailed = true | ||
| if( detailed && allRevisions ) { | ||
| all.each { | ||
| println(" $it") | ||
| def revManager = new AssetManager(it) | ||
| revManager.listRevisionsAndCommits().each { k, v -> | ||
| if( !moreDetailed ) | ||
| v = v.substring(0, 10) | ||
| println(" $v $k") | ||
| } | ||
| } | ||
| } else if( allRevisions ) { | ||
| all.each { | ||
| println(" $it") | ||
| def revManager = new AssetManager(it) | ||
| revManager.listRevisions().each { | ||
| println(" $it") | ||
| } | ||
| } | ||
| } else if( allCommits ) { | ||
| all.each { | ||
| println(" $it") | ||
| def revManager = new AssetManager(it) | ||
| revManager.listCommits().each { println(" $it") } | ||
| } | ||
| } else { | ||
| all.each { println(" $it") } | ||
| } | ||
| } else if( allCommits ) { | ||
| all.each{ | ||
| println(" $it") | ||
| def revManager = new AssetManager(it) | ||
| revManager.listCommits().each{ println(" $it") } | ||
| } | ||
| } else { | ||
| all.each{ println(" $it") } | ||
| } | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, try to make this logic more compact following "Reveal intention" pattern. https://claude.ai/share/32835bb7-8395-431e-a73f-53797de9aaf6
Alternative for #5089
This pull request refactors revision and commit management for pipeline assets, streamlining how revisions are tracked and handled across CLI commands and internal logic. The main changes include removing the legacy revision map mechanism, updating CLI flags for clarity and consistency, and improving concurrency safety when cloning repositories. These updates simplify the codebase and improve reliability when managing pipeline versions.
Revision and Commit Management Refactor
REVISION_MAP,DEFAULT_REVISION_DIRNAME) fromAssetManager, including related methods (getRevisionMap,revisionToCommitWithMap,updateRevisionMap, etc.). Revision tracking now relies directly on branch/tag and commit information from the repository. [1] [2] [3] [4] [5]CLI Improvements
-a, -all-revisionsflag to-a, -allinCmdDropfor clarity, and updated help descriptions accordingly.-d, -deepflag fromCmdPullandCmdRun, and marked it as deprecated in documentation for future removal. [1] [2] [3] [4]Concurrency and Reliability
AssetManager.createSharedCloneto prevent concurrent clones of the same commit, ensuring safe and reliable asset downloads. [1] [2]Codebase Cleanup
CmdDrop.groovy,CmdList.groovy,CmdPull.groovy). [1] [2] [3]These changes collectively modernize revision tracking and asset management, making the system more robust and maintainable.