Skip to content
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

gitdist: Add Default Development Branch Support #235

Closed
jmgate opened this issue Oct 26, 2017 · 8 comments
Closed

gitdist: Add Default Development Branch Support #235

jmgate opened this issue Oct 26, 2017 · 8 comments

Comments

@jmgate
Copy link
Collaborator

jmgate commented Oct 26, 2017

@bartlettroscoe, I had a realization while driving home today. The reason we as applications wanted to stay on a master/develop workflow—the reason for all the git trickery of renaming develop to real-develop and then creating a new develop branch for the application—was coming at least in part from a desire to use gitdist. For instance, if the application fork of Trilinos were to have the usual master and develop branches, and then a app-dev branch along the lines of what you showed for ROL, an app developer would have to do the following:

gitdist checkout develop
cd <trilinosLocation>
git checkout app-dev
gitdist checkout -b <featureBranch>
# do some work

and that little extra you need to do for Trilinos would be frustrating and easy to forget.

My earlier solution was all the git trickery in the application fork of Trilinos, but I realized we could solve the same problem in gitdist instead. Suppose we add some way to configure gitdist such that you can specify the main development branch in all the repos you're using gitdist to manage. I don't know if this would belong in the .gitdist file or elsewhere. Then we could add a command to gitdist to check out that default branch in all repos. For instance:

gitdist checkout-default-branch
gitdist checkout -b <featureBranch>
# do some work

Alternatively we may be able to do something along the lines of what you did with the repo version file, such that gitdist checkout __DEFAULT_BRANCH__ would understand what you meant. Actually I think I like this better, because we could also figure out how to gitdist merge __DEFAULT_BRANCH__ or gitdist rebase __DEFAULT_BRANCH__, etc.

I can try to whip something up in the morning.

@bartlettroscoe
Copy link
Member

@jmgate, let's meet tomorrow and talk about the EMPIRE workflow and how this might fit in. We should go the EMPIRE workflows and as they relate to Trilinos.

jmgate added a commit to jmgate/TriBITS that referenced this issue Oct 26, 2017
Here's an initial implementation that allows a user to add default
development branches to the .gitdist file in the form

. master
otherRepo develop
thirdRepo master

If those default development branches aren't specified, master is
assumed.  The user can then pass _DEFAULT_BRANCH_ to any command that
accepts a reference and gitdist should replace _DEFAULT_BRANCH_ with the
appropriate branch from the .gitdist file.
jmgate added a commit to jmgate/TriBITS that referenced this issue Oct 26, 2017
Here's an initial implementation that allows a user to add default
development branches to the .gitdist file in the form

. master
otherRepo develop
thirdRepo master

If those default development branches aren't specified, master is
assumed.  The user can then pass _DEFAULT_BRANCH_ to any command that
accepts a reference and gitdist should replace _DEFAULT_BRANCH_ with the
appropriate branch from the .gitdist file.
@jmgate
Copy link
Collaborator Author

jmgate commented Oct 27, 2017

@bartlettroscoe, while I'm grateful we'll be able to use a master/develop workflow in EMPIRE's fork of Trilinos, this feature would still be useful for development as Drekar and Charon, for instance, aren't using master/develop. For instance, when developing Trilinos, I now have the following .gitdist file:

. develop
DrekarBase master
EMPIRE develop
EMPIRE-DSMC develop
EMPIRE-Fluid develop
tcad-charon master
charon-data master
charon-ouo-data master

If it shouldn't make it into TriBITs, though, that's fine—I'll just keep it in my fork.

@bartlettroscoe
Copy link
Member

bartlettroscoe commented Oct 30, 2017

@jmgate, okay, I can see the desire for this in various use cases.

But before we can merge this to the TriBITS 'master' branchs we need to add automated tests and documentation. Can you look into doing this?

You can find automated tests for gitdist under TriBITS/test/python_utils/gitdist_UnitTests.py (see the ctest test in the CMakeLists.txt file). And documentation should be added as another --dist-help=default-branch category explaining this. If you can put that together, then I can review this.

@bartlettroscoe
Copy link
Member

We might call this topic --dist-help=default-branch.

@jmgate
Copy link
Collaborator Author

jmgate commented Oct 30, 2017

I'll look into it—thanks @bartlettroscoe.

jmgate added a commit to jmgate/TriBITS that referenced this issue Oct 31, 2017
Added documentation for the _DEFAULT_BRANCH_ feature.  You can access it
with --dist-help=default-branch.
@jmgate
Copy link
Collaborator Author

jmgate commented Oct 31, 2017

Added the help topic—looking into unit testing now…

jmgate added a commit to jmgate/TriBITS that referenced this issue Nov 1, 2017
Here's an initial implementation that allows a user to add default
development branches to the .gitdist file in the form

. master
otherRepo develop
thirdRepo master

If those default development branches aren't specified, master is
assumed.  The user can then pass _DEFAULT_BRANCH_ to any command that
accepts a reference and gitdist should replace _DEFAULT_BRANCH_ with the
appropriate branch from the .gitdist file.  The documentation for this
feature can be accessed with --dist-help=default-branch.
jmgate added a commit to jmgate/TriBITS that referenced this issue Nov 1, 2017
Here's an initial implementation that allows a user to add default
development branches to the .gitdist file in the form

. master
otherRepo develop
thirdRepo master

If those default development branches aren't specified, master is
assumed.  The user can then pass _DEFAULT_BRANCH_ to any command that
accepts a reference and gitdist should replace _DEFAULT_BRANCH_ with the
appropriate branch from the .gitdist file.  The documentation for this
feature can be accessed with --dist-help=default-branch.
@jmgate
Copy link
Collaborator Author

jmgate commented Nov 1, 2017

@bartlettroscoe, this initial implementation is now documented (--dist-help=default-branch) and protected by a unit test (test_dist_default_branch, based off of test_dot_gitdist).

Do you suppose there's any need to support a --default-branches=branch1,branch2,etc. command line option, analogous to --dist-repos=repo1,repo2,etc.? I doubt it, but if you'd like it for the sake of completeness, let me know.

@bartlettroscoe
Copy link
Member

I don't think we would need a --dist-default-branches argument. For more flexibility for things like this, we can just implement a special dist-for-each command (see #135).

I will take a look.

jmgate added a commit to jmgate/TriBITS that referenced this issue Nov 2, 2017
Here's an initial implementation that allows a user to add default
development branches to the .gitdist file in the form

. master
otherRepo develop
thirdRepo master

If those default development branches aren't specified, master is
assumed.  The user can then pass _DEFAULT_BRANCH_ to any command that
accepts a reference and gitdist should replace _DEFAULT_BRANCH_ with the
appropriate branch from the .gitdist file.  The documentation for this
feature can be accessed with --dist-help=default-branch.
jmgate added a commit to jmgate/TriBITS that referenced this issue Nov 2, 2017
Here's an initial implementation that allows a user to add default
development branches to the .gitdist file in the form

. master
otherRepo develop
thirdRepo master

If those default development branches aren't specified, master is
assumed.  The user can then pass _DEFAULT_BRANCH_ to any command that
accepts a reference and gitdist should replace _DEFAULT_BRANCH_ with the
appropriate branch from the .gitdist file.  The documentation for this
feature can be accessed with --dist-help=default-branch.
bartlettroscoe added a commit to jmgate/TriBITS that referenced this issue Nov 3, 2017
I also moved 'default-branch' before 'usage-tips' because I think that is a
more natural order, expecially for --dist-help=all.
bartlettroscoe added a commit to trilinos/Trilinos that referenced this issue Nov 8, 2017
* Improve error messages from new TriBITS usage checks (TriBITSPub/TriBITS#200).

* Some new features for gitdist:
  - default-branch (TriBITSPub/TriBITS#235)
  - move-to-base-dir (TriBITSPub/TriBITS#212)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants