From ea2a4e14a829b00bac1d08c733c7a484cb0a9cf1 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 3 Jul 2008 23:38:03 -0400 Subject: [PATCH] cmd_commit: if we have a saved commit message, start the editor with that --- README | 1 - yap/yap.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README b/README index 5db413a..8f0c303 100644 --- a/README +++ b/README @@ -24,7 +24,6 @@ TODO: * cherry-pick * -r to apply the opposite * Better commit template message - * prepopulate with old commit message after uncommit? * Fixups for running outside root? * Handle unmerged files in status * No commit while rebasing/am diff --git a/yap/yap.py b/yap/yap.py index 852131c..395dbd2 100644 --- a/yap/yap.py +++ b/yap/yap.py @@ -271,6 +271,17 @@ class Yap(object): fd, tmpfile = tempfile.mkstemp("yap") os.close(fd) + + repo = get_output('git rev-parse --git-dir')[0] + msg_file = os.path.join(repo, 'yap', 'msg') + if os.access(msg_file, os.R_OK): + fd1 = file(msg_file) + fd2 = file(tmpfile, 'w') + for l in fd1.xreadlines(): + print >>fd2, l.strip() + fd2.close() + os.unlink(msg_file) + if os.system("%s '%s'" % (editor, tmpfile)) != 0: raise YapError("Editing commit message failed") if parent != 'HEAD': -- 2.11.4.GIT