Skip to content

Commit

Permalink
Be more careful with commit. Back where we were, using pager.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Kam committed Feb 19, 2008
1 parent f6bf6b8 commit 1d407c8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions todo.py
Expand Up @@ -105,9 +105,15 @@
############################################################
# Be careful changing things below here

import re, os, sys, time, getopt, sets
import re, os, sys, time, getopt, sets, subprocess
from shutil import copyfile

# Guess the pager!
try:
PAGER = os.environ['PAGER']
except KeyError:
PAGER = 'less'

def usage():
text = "Usage: todo.py [options] [ACTION] [PARAM...] \n"
text += "Try `todo.py -h' for more information."
Expand Down Expand Up @@ -284,8 +290,8 @@ def help(longmessage = False):
def commit(files,msg):
os.chdir(TODO_DIR)
for i in files:
os.spawnlp(os.P_WAIT,"git","git","add",i)
os.spawnlp(os.P_WAIT,"git","git","commit","-m","%s" % msg)
subprocess.Popen(["git","add",i]).wait()
subprocess.Popen(["git","commit","-m","%s" % msg]).wait()

def setDirs(dir):
"""Your todo/done/report.txt locations"""
Expand Down Expand Up @@ -578,6 +584,7 @@ def list(patterns=None, userinput=True, showChildren=False, \
matchAny - switch, patterns are AND (False) or OR (True) matched
dates - list of date patterns for search OR matched
"""
sys.stdout = os.popen(PAGER,'w')
items = []
temp = {}
tasks = getTaskDict()
Expand Down Expand Up @@ -1186,7 +1193,7 @@ def failChild(action):
list(x, False)
elif (action == "l" or action == "log"):
os.chdir(TODO_DIR)
os.spawnlp(os.P_WAIT,"git","git","log")
subprocess.Popen(["git","log"]).wait()
elif (action == "pri" or action == "p"):
if (len(args) == 2 and args[0].isdigit() and args[1].isalpha()):
prioritize(int(args[0]), args[1])
Expand Down

0 comments on commit 1d407c8

Please sign in to comment.