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

prefs: option to automatically load template commit #1013

Merged
merged 5 commits into from
Nov 19, 2019

Conversation

iqdecay
Copy link
Contributor

@iqdecay iqdecay commented Nov 17, 2019

  • Add cola.commit.autotemplate constant in preferences
  • Add checkbox in both "All repositories" and "Current repository"
  • Load commit template if needed when opening new repository

Closes #735

- Add AUTOTEMPLATE constant to models/prefs.py
- Set autotemplate to False in Defaults class

Signed-off-by: Victor Nepveu <victor.nepveu@imt-atlantique.net>
- Add checkbox to automatically load commit template
- Update autotemplate variable if a change is detected

Signed-off-by: Victor Nepveu <victor.nepveu@imt-atlantique.net>
- Replace self.new_commitmsg with template commit message when
reinitializing the commit message editor if AUTOTEMPLATE is True

Signed-off-by: Victor Nepveu <victor.nepveu@imt-atlantique.net>
- If AUTOTEMPLATE is True, load the commit template
  when opening a new repository
- Fix line length in widgets/prefs.py

Signed-off-by: Victor Nepveu <victor.nepveu@imt-atlantique.net>
@@ -9,6 +9,7 @@
from ..cmd import Command


AUTOTEMPLATE = "cola.commit.autotemplate"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single quotes for consistency, please. This seems reasonable. One small note -- everywhere else we use just a single flat namespace for config values. e.g. cola.autoloadcommittemplate is more in-line with the rest of the config keys we use. In documentation we spell it as cola.autoloadCommitTemplate which helps the readability.

Please make sure this feature is documented in doc/git-cola.rst in the CONFIGURATION VARIABLES section.

Copy link
Contributor Author

@iqdecay iqdecay Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AUTOTEMPLATE = "cola.commit.autotemplate"
AUTOTEMPLATE = "cola.autoloadcommittemplate"

I used this format because of your comment (see #735 (comment))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry for not remembering. Thanks for the updates.

Copy link
Member

@davvid davvid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation, please.

- Change name to further consistency
- Change double quotes to single quotes
- Document the variable
davvid added a commit that referenced this pull request Nov 19, 2019
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit that referenced this pull request Nov 19, 2019
* vnepveu/issue735:
  Modify and document AUTOTEMPLATE variable
  preferences: load template when opening repo
  preferences: replace commit message with template
  preferences: automatically load commit template
  preferences: add autotemplate variable

Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid davvid merged commit 850f91e into git-cola:master Nov 19, 2019
bmwiedemann added a commit to bmwiedemann/openSUSE that referenced this pull request Nov 28, 2019
https://build.opensuse.org/request/show/751369
by user dimstar_suse
- Update to 3.6
- Usability, bells and whistles
* The remote editor is much faster since it no longer queries
  remotes, and uses the cached information instead.
  git-cola/git-cola#986
* Commit message templates can now be loaded automatically by setting
  ``git config cola.autoloadcommittemplate true``.
  git-cola/git-cola#1013
  git-cola/git-cola#735
* The UI layout can now be reset back to its initial state by selecting
  the "Reset Layout" action.  This reverts the layout to the same state
  as when the app first launched.
  git-cola/git-cola#1008
  git-cola/git-cola#994
* Files can now be ignored in either the project's `.gitignore`, or in the
  repository's priv
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

Successfully merging this pull request may close these issues.

Option to automatically add commit message template?
2 participants