Skip to content

Commit

Permalink
Small changes to documentation (TriBITSPub#235)
Browse files Browse the repository at this point in the history
I also moved 'default-branch' before 'usage-tips' because I think that is a
more natural order, expecially for --dist-help=all.
  • Loading branch information
bartlettroscoe committed Nov 3, 2017
1 parent b7fdc87 commit 6c16fcb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions test/python_utils/gitdist_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,15 +678,15 @@ def test_dist_help_all_help(self):
# Tet that --dist-help --help prints nice error message
def test_dist_help_help(self):
cmndOut = getCmndOutput(gitdistPath+" --dist-help --help")
cmndOut_expected = "gitdist: error: option --dist-help: invalid choice: '--help' (choose from '', 'overview', 'repo-selection-and-setup', 'dist-repo-status', 'repo-versions', 'aliases', 'usage-tips', 'script-dependencies', 'default-branch', 'all')\n"
cmndOut_expected = "gitdist: error: option --dist-help: invalid choice: '--help' (choose from '', 'overview', 'repo-selection-and-setup', 'dist-repo-status', 'repo-versions', 'aliases', 'default-branch', 'usage-tips', 'script-dependencies', 'all')\n"
self.assertEqual(s(cmndOut), s(cmndOut_expected))


# Test --dist-helps=invalid-pick picked up as invalid value.
def test_dist_help_invalid_pick_help(self):
cmndOut = getCmndOutput(gitdistPath+" --dist-help=invalid-pick --help")
assertContainsGitdistHelpHeader(self, cmndOut)
errorToFind = "gitdist: error: option --dist-help: invalid choice: 'invalid-pick' (choose from '', 'overview', 'repo-selection-and-setup', 'dist-repo-status', 'repo-versions', 'aliases', 'usage-tips', 'script-dependencies', 'default-branch', 'all')"
errorToFind = "gitdist: error: option --dist-help: invalid choice: 'invalid-pick' (choose from '', 'overview', 'repo-selection-and-setup', 'dist-repo-status', 'repo-versions', 'aliases', 'default-branch', 'usage-tips', 'script-dependencies', 'all')"
self.assertEqual(
GeneralScriptSupport.extractLinesMatchingSubstr(cmndOut,errorToFind), errorToFind+"\n")

Expand Down
86 changes: 43 additions & 43 deletions tribits/python_utils/gitdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def s(x):
'dist-repo-status',
'repo-versions',
'aliases',
'default-branch',
'usage-tips',
'script-dependencies',
'default-branch'
'script-dependencies'
]


Expand Down Expand Up @@ -469,6 +469,47 @@ def getHelpTopicsStr():
helpTopicsDict.update( { 'aliases' : usefulAliasesHelp } )


defaultBranchHelp = r"""
DEFAULT BRANCH SPECIFICATION:
When using any git command that accepts a reference (a SHA1, or branch or tag
name), it is possible to use _DEFAULT_BRANCH_ instead. For instance,
gitdist checkout _DEFAULT_BRANCH_
will check out the default development branch in each repository being managed
by gitdist. You can specify the default branch for each repository in your
.gitdist[.default] file. For instance, if your .gitdist file contains
. master
extraRepo1 develop
extraRepo2 app-devel
then the command above would check out 'master' in the base repo, 'develop' in
extraRepo1, and 'app-devel' in extraRepo2. This makes it convenient when
working with multiple repositories that have different names for their main
development branches. For instance, you can do a topic branch workflow like:
gitdist checkout _DEFAULT_BRANCH_
gitdist pull
gitdist checkout -b newFeatureBranch
<create some commits>
gitdist fetch
gitdist merge origin/_DEFAULT_BRANCH_
<create some commits>
gitdist checkout _DEFAULT_BRANCH_
gitdist pull
gitdist merge newFeatureBranch
and not worry about this 'newFeatureBranch' being off of 'master' in the root
repo, off of 'develop' in extraRepo1, and off of 'app-devel' in extraRepo2.
If no branch name is specified for any given repository in the
.gitdist[.default] file, then 'master' is assumed.
"""
helpTopicsDict.update( { 'default-branch' : defaultBranchHelp } )


usageTipsHelp = r"""
USAGE TIPS:
Expand Down Expand Up @@ -614,47 +655,6 @@ def getHelpTopicsStr():
helpTopicsDict.update( { 'script-dependencies' : scriptDependenciesHelp } )


defaultBranchHelp = r"""
DEFAULT BRANCH SPECIFICATION:
When using any git command that accepts a reference (a SHA1, or branch or tag
name), it is possible to use _DEFAULT_BRANCH_ instead. For instance,
gitdist checkout _DEFAULT_BRANCH_
will check out the default development branch in each repository being managed
by gitdist. You can specify the default branch for each repository in your
.gitdist[.default] file. For instance, if your .gitdist file contains
. master
extraRepo1 develop
extraRepo2 app-devel
then the command above would check out master in the base repo, develop in
extraRepo1, and app-devel in extraRepo2. This makes it convenient when working
with multiple repositories that have different names for their main development
branches. For instance, you can
gitdist checkout _DEFAULT_BRANCH_
gitdist pull
gitdist checkout -b newFeatureBranch
# do some work
gitdist fetch
gitdist merge _DEFAULT_BRANCH_
# do some more work
gitdist checkout _DEFAULT_BRANCH_
gitdist pull
gitdist merge newFeatureBranch
and not worry about this newFeatureBranch being off of master in the root repo,
off of develop in extraRepo1, and off of app-devel in extraRepo2.
If no branch name is specified for any given repository in the
.gitdist[.default] file, then master is assumed.
"""
helpTopicsDict.update( { 'default-branch' : defaultBranchHelp } )


#
# Functions to help Format an ASCII table
#
Expand Down

0 comments on commit 6c16fcb

Please sign in to comment.