summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2015-05-07 11:00:11 -0400
committerBill Peck <bpeck@redhat.com>2015-05-07 11:00:11 -0400
commitfbd4bd4bdaae915c469ade5dad3123f4f852a3de (patch)
treeb0626db8841df767fc181cb93a0ff908bc266e99
parenta6ceb1d25135a6dc550012929fb5911f3757da39 (diff)
downloadtaskrepo-fbd4bd4bdaae915c469ade5dad3123f4f852a3de.tar.gz
taskrepo-fbd4bd4bdaae915c469ade5dad3123f4f852a3de.tar.xz
taskrepo-fbd4bd4bdaae915c469ade5dad3123f4f852a3de.zip
small help changes in commands
Update_task will now remove it from the DB if its gone on disk.
-rw-r--r--git_taskrepo/sub_commands/cmd_init.py2
-rw-r--r--git_taskrepo/sub_commands/cmd_list.py (renamed from git_taskrepo/sub_commands/cmd_list_tasks.py)4
-rw-r--r--git_taskrepo/sub_commands/cmd_list_runfor.py2
-rw-r--r--git_taskrepo/sub_commands/cmd_list_types.py2
-rw-r--r--git_taskrepo/sub_commands/cmd_update.py2
-rw-r--r--git_taskrepo/taskrepo.py13
6 files changed, 19 insertions, 6 deletions
diff --git a/git_taskrepo/sub_commands/cmd_init.py b/git_taskrepo/sub_commands/cmd_init.py
index e59f6a5..2a2ea27 100644
--- a/git_taskrepo/sub_commands/cmd_init.py
+++ b/git_taskrepo/sub_commands/cmd_init.py
@@ -24,7 +24,7 @@ def update_file(filename, line_to_add):
return updated
class Init(Command):
- """Init Task Repo"""
+ """Init taskrepo"""
enabled = True
def options(self):
diff --git a/git_taskrepo/sub_commands/cmd_list_tasks.py b/git_taskrepo/sub_commands/cmd_list.py
index 0c311b0..20197b0 100644
--- a/git_taskrepo/sub_commands/cmd_list_tasks.py
+++ b/git_taskrepo/sub_commands/cmd_list.py
@@ -4,8 +4,8 @@
import xml.dom.minidom
from git_taskrepo.command import Command
-class List_Tasks(Command):
- """List Tasks"""
+class List(Command):
+ """List tasks available in taskrepo. see --help for more options"""
enabled = True
def options(self):
diff --git a/git_taskrepo/sub_commands/cmd_list_runfor.py b/git_taskrepo/sub_commands/cmd_list_runfor.py
index fca58bb..49936b3 100644
--- a/git_taskrepo/sub_commands/cmd_list_runfor.py
+++ b/git_taskrepo/sub_commands/cmd_list_runfor.py
@@ -5,7 +5,7 @@ import xml.dom.minidom
from git_taskrepo.command import Command
class List_RunFor(Command):
- """List Runfor"""
+ """List choices for filtering on runfor"""
enabled = True
def options(self):
diff --git a/git_taskrepo/sub_commands/cmd_list_types.py b/git_taskrepo/sub_commands/cmd_list_types.py
index 0000a4f..d7e4bbc 100644
--- a/git_taskrepo/sub_commands/cmd_list_types.py
+++ b/git_taskrepo/sub_commands/cmd_list_types.py
@@ -5,7 +5,7 @@ import xml.dom.minidom
from git_taskrepo.command import Command
class List_Types(Command):
- """List Types"""
+ """List choices to filter on type"""
enabled = True
def options(self):
diff --git a/git_taskrepo/sub_commands/cmd_update.py b/git_taskrepo/sub_commands/cmd_update.py
index 91f30db..089c5cf 100644
--- a/git_taskrepo/sub_commands/cmd_update.py
+++ b/git_taskrepo/sub_commands/cmd_update.py
@@ -6,7 +6,7 @@ from git_taskrepo.command import Command
from git_taskrepo.taskrepo import update_taskrepo, parse_testinfo, TRX
class Update(Command):
- """Update Task Repo"""
+ """Update Taskrepo for <TASK>"""
enabled = True
def options(self):
diff --git a/git_taskrepo/taskrepo.py b/git_taskrepo/taskrepo.py
index b53d782..026c1c4 100644
--- a/git_taskrepo/taskrepo.py
+++ b/git_taskrepo/taskrepo.py
@@ -24,6 +24,18 @@ class TRX_TestInfo(TRX):
def only_ascii(s):
return filter(lambda x: x in string.printable, s)
+def _delete_taskrepo(taskrepo, taskname):
+ with taskrepo:
+ cur = taskrepo.cursor()
+ cur.execute("SELECT id FROM tasks WHERE name=?", (taskname,))
+ result = cur.fetchone()
+ if result:
+ taskid = result[0]
+ for key in keys:
+ # Clear old values
+ cur.execute("DELETE FROM %s WHERE task_id=?" % key, (taskid,))
+ cur.execute("DELETE FROM tasks WHERE id=?", (taskid,))
+
def _update_taskrepo(taskrepo, taskname, testinfo):
with taskrepo:
cur = taskrepo.cursor()
@@ -60,6 +72,7 @@ def update_taskrepo(repo, taskrepo, taskpath):
raise
_update_taskrepo(taskrepo, taskname, testinfo)
else:
+ _delete_taskrepo(taskrepo, taskname)
raise TRX_TestInfo('No testinfo.desc')
def parse_testinfo(filename):