Permalink
Browse files

if -m is passed, don't prompt for a message in EDITOR

  • Loading branch information...
1 parent 712d059 commit b7762eeca09ba5d7c7544812204ff631b855c6d6 @herlo herlo committed Jan 9, 2012
Showing with 18 additions and 18 deletions.
  1. +1 −1 scripts/skein
  2. +17 −17 skein/pyskein.py
View
@@ -70,7 +70,7 @@ def main():
p_import = sp.add_parser("import", help=u"import srpm(s). Performs extract, push and upload.")
p_import.add_argument("path", nargs='+', help=u"path(s) to srpm. If dir given, will import all srpms")
- p_import.add_argument("-m", "--message", metavar="message_data", help="optional commit message.")
+ p_import.add_argument("-m", "--message", metavar="message", help="optional commit message.")
p_import.set_defaults(func=ps.do_import_pkg)
p_revoke = sp.add_parser("revoke", help=u"revoke a repo create request")
View
@@ -488,30 +488,30 @@ def _commit(self, reason=None):
self.logger.info("||== Committing git repo ==||")
- reason = None
- editor = os.environ.get('EDITOR') if os.environ.get('EDITOR') else self.cfgs['skein']['editor']
+ if not reason:
+ editor = os.environ.get('EDITOR') if os.environ.get('EDITOR') else self.cfgs['skein']['editor']
- tmp_file = tempfile.NamedTemporaryFile(suffix=".tmp")
+ tmp_file = tempfile.NamedTemporaryFile(suffix=".tmp")
- initial_message = self.cfgs['git']['commit_message']
+ initial_message = self.cfgs['git']['commit_message']
- tmp_file.write(initial_message)
- tmp_file.flush()
+ tmp_file.write(initial_message)
+ tmp_file.flush()
- cmd = [editor, tmp_file.name]
+ cmd = [editor, tmp_file.name]
- try:
- p = subprocess.check_call(cmd)
- f = open(tmp_file.name, 'r')
- reason = f.read()
+ try:
+ p = subprocess.check_call(cmd)
+ f = open(tmp_file.name, 'r')
+ reason = f.read()
- if not reason:
- raise SkeinError("Description required.")
- elif reason == initial_message:
- raise SkeinError("Description has not changed.")
+ if not reason:
+ raise SkeinError("Description required.")
+ elif reason == initial_message:
+ raise SkeinError("Description has not changed.")
- except subprocess.CalledProcessError:
- raise SkeinError("Action cancelled by user.")
+ except subprocess.CalledProcessError:
+ raise SkeinError("Action cancelled by user.")
index = self.repo.index

0 comments on commit b7762ee

Please sign in to comment.