cksource / mrgit

A tool for managing projects build using multiple repositories.
49 stars 9 forks source link

Support for "standard branches" #103

Closed Reinmar closed 5 years ago

Reinmar commented 5 years ago

Currently, when you call mgit sync it uses the master branch in every repo, unless the repo's branch is defined in mgit.json.

It'd be useful if mgit could also use stable when the main repo is on stable. That would allow us to stop changing mgit.json on ckeditor5#stable which is inconvenient and leads to problems.

Theoretically, we could make mgit sync (and mgit co) use the current branch of the main repo in all cases where the branch is not defined in mgit.json. So, e.g. when ckeditor5 is on t/foo, all repos would be switched to t/foo. But I don't think that this would be that useful because unlike stable, the ticket branches are very rarely defined in all repos. Plus, if you don't need to change mgit.json why would you create t/foo in ckeditor5.

Therefore, I'd like to call this feature e.g. coreBranches and define it in mgit.json like this:

{
  "packages": "packages/",
  "packagesPrefix": "@ckeditor/ckeditor5-",
  "standardBranches": [ "master", "stable" ],
  "dependencies": {
    "@ckeditor/ckeditor5-adapter-ckfinder": "ckeditor/ckeditor5-adapter-ckfinder",
    "@ckeditor/ckeditor5-alignment": "ckeditor/ckeditor5-alignment",
    "@ckeditor/ckeditor5-autoformat": "ckeditor/ckeditor5-autoformat",
    "@ckeditor/ckeditor5-autosave": "ckeditor/ckeditor5-autosave",
    "@ckeditor/ckeditor5-basic-styles": "ckeditor/ckeditor5-basic-styles",
    "@ckeditor/ckeditor5-block-quote": "ckeditor/ckeditor5-block-quote",
    "@ckeditor/ckeditor5-build-balloon": "ckeditor/ckeditor5-build-balloon",
    ...
  }
}
pomek commented 5 years ago

What in case if one of dependency has defined custom branch in mgit.json?

Reinmar commented 5 years ago

It'd switch to that branch. The algorithm that I'm proposing would work like this:

  1. Check if branch is defined in mgit.json. Use it if is.
  2. Check if the main repo is on one of std branches. If yes, use that branch.
  3. Use master otherwise.