Scripts for repository management
My way of working
Like everyone else, I tend to refer to the things I work on as "projects".
In order to take full advantage of my daily experiences with the things I have made, I have the scripts / symlinks that they start point to the version that I also develop on. That gives me immediate feedback about the things I'm adjusting. I call this my "working" environment.
When I am satisfied - and that includes performing unit tests - I transfer the stuff to a repository that I basically never make adjustments in, so that I also have a stable version on my system. I call this my "central" environment.
From here I can finally transfer the stuff to GitHub so that I also saved a version outside my laptop, just in case. The name for this environment is "remote".
Periodically checking everything at once has my preference because it gives me the opportunity to think about whether I want to commit things that I have not yet committed or rather rollback and approach differently.
The available commands
Most of these commands take an option -n to specify on or more repository names. If more than one, they must be separated with comma's, without spaces following them (which my muscle memory doesn't like). Omitting this argument means processing all (active) repositories.
- repo.check-local (can also be called as "repocheck")
this is a task I periodically perform to see which repositories contain modifications. I then use check-repo to see if I need to commit anything and/or if things are ready to be pushed (migrated to the next repository).
Output is a summation like
Details are saved to a file that you can view using the command
- repo.check-local-changes
it opens a file containing information produced by "git log" and "git status" in a text editor.
- repo.check-local-notes
This opent een treedocs bestand containing among others notes about repos that are (not) to be pushed and why
- repo.check-remote
does the same as "check-local" but for the "central" vs GitHub repositories. Fortunately Git saves this information in the pushing directory so that you don't have to go to the remote server. In earlier days I prevented this with a whole self-built mechanism saving this info in what I called "tip-files"
- repo.push-local [--exclude=<reponames>] [--include=<reponames>]
does the same as "check-local" maar also migrates (pushes) the committed changes to the next ("central") environment (repo).
Besides specifying which repo's je do want to push you can also specify which repo's you don't want to push
- repo.push-remote [--exclude=<reponames>] [--include=<reponames>]
does the same as "push-local" maar from "central" to remote
- repo.list-branches
wrapper around git branch to used it for more repo's at the same time
- repo.add2gitweb [--names=<reponames>] [--frozen]
add a repository to the configuratiso that is can be viewed using gitweb
- repo.dtree --name=<reponame>
Open a treedocs document containing project information / documentation. Used by my "session management".
- repo.mee-bezig
Open a treedocs document with overviewy information about all projects
- repo.overview --name=<reponame> [--outtype=<output-type>]
Build a history file from the repository logs, possibly outputting in csv format.
- repo.prshell --name=<reponame>
Open a (larger than the default size) terminal in the project root. Used by my "session management".
- repo.preadme --name=<reponame>
Open the readme document voor a project in a text editor
- repo.rreadme --name=<reponame>
Open the readme document voor a project in an rst viewer.
- repo.qgit --name=<reponame>
Open a Git gui for a project. Could be an alternative for check-repo, I have to look into it some time.
- repo.runtests --name=<reponame> [<test>]
run (all or selected) registered unittests for a given project
- repo.find-failing-tests
execute unittests and report the failing ones for one or more given repositories
- repo.find-test-errors
execute unittests and report the tests that have errors
- repo.find-test-stats
execute unittests and show the coverage for one or more given repositories
- repo.search-all --find=<search-term> [--rebuild]
search in all tracked python files in all repos
- repo.search-p --find=<search-term> [--rebuild]
like "search-all" but only for program code
- repo.search-t --find=<search-term> [--rebuild]
like "search-all" but for test modules