--- a/.hgignore Sun Oct 03 17:46:20 2010 -0400
+++ b/.hgignore Sun Oct 03 18:43:47 2010 -0400
@@ -1,3 +1,4 @@
syntax: glob
*.pyc
.DS_Store
+*.un~
--- a/SpeedResults.txt Sun Oct 03 17:46:20 2010 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-These are the cProfile results of running the original prefix function
-against the new prefix function. The original function ran in ~O(n^2)
-time, the new one runs in ~O(n) time.
-
-You can also run prefixcheck.check_prefixes() to confirm there is no
-regression from original to new.
-
-It is worth noting that
-
------
-
-Size: 1
-
-t_prefixes()
- 8 function calls in 0.000 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.000 0.000 <string>:1(<module>)
- 1 0.000 0.000 0.000 0.000 prefixcheck.py:14(t_prefixes)
- 1 0.000 0.000 0.000 0.000 {any}
- 1 0.000 0.000 0.000 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {map}
- 1 0.000 0.000 0.000 0.000 {method 'difference' of 'set' objects}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.000 0.000 0.000 0.000 {range}
-
-
-new_prefixes()
- 8 function calls in 0.000 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.000 0.000 <string>:1(<module>)
- 1 0.000 0.000 0.000 0.000 prefixcheck.py:38(new_prefixes)
- 1 0.000 0.000 0.000 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.000 0.000 0.000 0.000 {method 'keys' of 'dict' objects}
- 1 0.000 0.000 0.000 0.000 {method 'values' of 'dict' objects}
- 1 0.000 0.000 0.000 0.000 {range}
- 1 0.000 0.000 0.000 0.000 {zip}
-
-
------
-
-Size: 10
-
-t_prefixes()
- 2973 function calls in 0.009 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.009 0.009 <string>:1(<module>)
- 1 0.001 0.001 0.009 0.009 prefixcheck.py:14(t_prefixes)
- 1323 0.004 0.000 0.006 0.000 prefixcheck.py:29(<lambda>)
- 147 0.000 0.000 0.000 0.000 {any}
- 10 0.000 0.000 0.000 0.000 {len}
- 147 0.002 0.000 0.008 0.000 {map}
- 10 0.000 0.000 0.000 0.000 {method 'difference' of 'set' objects}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1323 0.002 0.000 0.002 0.000 {method 'startswith' of 'str' objects}
- 10 0.000 0.000 0.000 0.000 {range}
-
-
-new_prefixes()
- 30 function calls in 0.000 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.000 0.000 <string>:1(<module>)
- 1 0.000 0.000 0.000 0.000 prefixcheck.py:38(new_prefixes)
- 10 0.000 0.000 0.000 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.000 0.000 0.000 0.000 {method 'keys' of 'dict' objects}
- 1 0.000 0.000 0.000 0.000 {method 'values' of 'dict' objects}
- 14 0.000 0.000 0.000 0.000 {range}
- 1 0.000 0.000 0.000 0.000 {zip}
-
-
------
-
-Size: 100
-
-t_prefixes()
- 265303 function calls in 0.831 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.831 0.831 <string>:1(<module>)
- 1 0.009 0.009 0.830 0.830 prefixcheck.py:14(t_prefixes)
- 131175 0.397 0.000 0.597 0.000 prefixcheck.py:29(<lambda>)
- 1325 0.003 0.000 0.003 0.000 {any}
- 100 0.000 0.000 0.000 0.000 {len}
- 1325 0.221 0.000 0.817 0.001 {map}
- 100 0.001 0.000 0.001 0.000 {method 'difference' of 'set' objects}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 131175 0.200 0.000 0.200 0.000 {method 'startswith' of 'str' objects}
- 100 0.000 0.000 0.000 0.000 {range}
-
-
-new_prefixes()
- 257 function calls in 0.002 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.002 0.002 <string>:1(<module>)
- 1 0.001 0.001 0.002 0.002 prefixcheck.py:38(new_prefixes)
- 100 0.000 0.000 0.000 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.000 0.000 0.000 0.000 {method 'keys' of 'dict' objects}
- 1 0.000 0.000 0.000 0.000 {method 'values' of 'dict' objects}
- 151 0.000 0.000 0.000 0.000 {range}
- 1 0.000 0.000 0.000 0.000 {zip}
-
-
------
-
-Size: 1000
-
-t_prefixes()
- 25827686 function calls in 79.873 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 79.873 79.873 <string>:1(<module>)
- 1 0.248 0.248 79.873 79.873 prefixcheck.py:14(t_prefixes)
- 12899060 38.676 0.000 58.231 0.000 prefixcheck.py:29(<lambda>)
- 13298 0.073 0.000 0.073 0.000 {any}
- 989 0.002 0.000 0.002 0.000 {len}
- 13298 21.266 0.002 79.497 0.006 {map}
- 989 0.050 0.000 0.050 0.000 {method 'difference' of 'set' objects}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 12899060 19.555 0.000 19.555 0.000 {method 'startswith' of 'str' objects}
- 989 0.003 0.000 0.003 0.000 {range}
-
-
-new_prefixes()
- 2534 function calls in 0.019 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.000 0.000 0.019 0.019 <string>:1(<module>)
- 1 0.011 0.011 0.019 0.019 prefixcheck.py:38(new_prefixes)
- 989 0.001 0.000 0.001 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.000 0.000 0.000 0.000 {method 'keys' of 'dict' objects}
- 1 0.000 0.000 0.000 0.000 {method 'values' of 'dict' objects}
- 1539 0.003 0.000 0.003 0.000 {range}
- 1 0.003 0.003 0.003 0.003 {zip}
-
-
------
-
-Size: 10000
-
-Too big to run t_prefixes() efficiently. Would take several minutes.
-
-new_prefixes()
- 25448 function calls in 0.212 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.001 0.001 0.212 0.212 <string>:1(<module>)
- 1 0.125 0.125 0.210 0.210 prefixcheck.py:38(new_prefixes)
- 9957 0.014 0.000 0.014 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.003 0.003 0.003 0.003 {method 'keys' of 'dict' objects}
- 1 0.001 0.001 0.001 0.001 {method 'values' of 'dict' objects}
- 15485 0.029 0.000 0.029 0.000 {range}
- 1 0.037 0.037 0.037 0.037 {zip}
-
-
------
-
-Size: 100000
-
-Too big to run t_prefixes() efficiently. Would take several minutes.
-
-new_prefixes()
- 253838 function calls in 3.780 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.021 0.021 3.780 3.780 <string>:1(<module>)
- 1 1.490 1.490 3.759 3.759 prefixcheck.py:38(new_prefixes)
- 99615 0.139 0.000 0.139 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.041 0.041 0.041 0.041 {method 'keys' of 'dict' objects}
- 1 0.016 0.016 0.016 0.016 {method 'values' of 'dict' objects}
- 154217 0.274 0.000 0.274 0.000 {range}
- 1 1.798 1.798 1.798 1.798 {zip}
-
-
------
-
-Size: 1000000
-
-Too big to run t_prefixes() efficiently. Would take several minutes.
-
-new_prefixes()
- 2530533 function calls in 151.824 CPU seconds
-
- Ordered by: standard name
-
- ncalls tottime percall cumtime percall filename:lineno(function)
- 1 0.256 0.256 151.824 151.824 <string>:1(<module>)
- 1 16.424 16.424 151.569 151.569 prefixcheck.py:38(new_prefixes)
- 996118 1.388 0.000 1.388 0.000 {len}
- 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
- 1 0.397 0.397 0.397 0.397 {method 'keys' of 'dict' objects}
- 1 0.159 0.159 0.159 0.159 {method 'values' of 'dict' objects}
- 1534409 2.731 0.000 2.731 0.000 {range}
- 1 130.471 130.471 130.471 130.471 {zip}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/basic.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,23 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Adding tasks:
+
+ $ xt
+ $ xt Sample one.
+ $ xt
+ 3 - Sample one.
+ $ xt Sample two.
+ $ xt
+ 7 - Sample two.
+ 3 - Sample one.
+
+Finishing tasks:
+
+ $ xt -f 3
+ $ xt
+ 7 - Sample two.
+ $ xt -f 7
+ $ xt
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/collisions.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,82 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Make some tasks that collide in their first letter:
+
+ $ xt 1
+ $ xt 2
+ $ xt 3
+ $ xt 4
+ $ xt 5
+ $ xt 6
+ $ xt 7
+ $ xt 8
+ $ xt 9
+ $ xt 10
+ $ xt 11
+ $ xt 12
+ $ xt 13
+ $ xt 14
+ $ xt
+ 0 - 9
+ 3 - 1
+ 1b - 4
+ 7b - 12
+ fe - 8
+ bd - 13
+ 77 - 3
+ c - 6
+ 9 - 7
+ b1 - 10
+ a - 5
+ fa - 14
+ 17 - 11
+ d - 2
+
+Even more ambiguity:
+
+ $ xt 1test
+ $ xt 2test
+ $ xt 3test
+ $ xt 4test
+ $ xt 5test
+ $ xt 6test
+ $ xt 7test
+ $ xt 8test
+ $ xt 9test
+ $ xt 10test
+ $ xt 11test
+ $ xt 12test
+ $ xt 13test
+ $ xt 14test
+ $ xt
+ 0a - 9
+ bd - 13
+ d - 2
+ ee - 1test
+ fe - 8
+ 77 - 3
+ 2 - 5test
+ 14 - 6test
+ 35 - 1
+ 90 - 7
+ 8 - 12test
+ b1d - 10
+ 17 - 11
+ a1 - 7test
+ 7b - 12
+ c7 - 13test
+ 07 - 8test
+ 36 - 4test
+ 6 - 11test
+ 0e - 9test
+ b10 - 10test
+ 95 - 3test
+ fa - 14
+ 1b - 4
+ ef - 14test
+ 5 - 2test
+ c1 - 6
+ ac - 5
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/editing.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,19 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Replace a task's text (preserving the ID):
+
+ $ xt Sample.
+ $ xt
+ a - Sample.
+ $ xt -e a New sample.
+ $ xt
+ a - New sample.
+
+Sed-style substitution:
+
+ $ xt -e a 's/New/Testing/'
+ $ xt
+ a - Testing sample.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/errors.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,140 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Add some test tasks:
+
+ $ xt Sample one.
+ $ xt Sample two.
+
+Bad prefix:
+
+ $ xt -f BAD
+ The ID "BAD" does not match any task.%
+ $ xt -e BAD This should not be replaced.
+ The ID "BAD" does not match any task.%
+ $ xt
+ 7 - Sample two.
+ 3 - Sample one.
+
+Ambiguous identifiers:
+
+ $ xt 1
+ $ xt 2
+ $ xt 3
+ $ xt 4
+ $ xt 5
+ $ xt 6
+ $ xt 7
+ $ xt 8
+ $ xt 9
+ $ xt 10
+ $ xt 11
+ $ xt 12
+ $ xt 13
+ $ xt 14
+ $ xt -f 1
+ The ID "1" matches more than one task.%
+ $ xt -f e This should not be replaced.
+ The ID "e" does not match any task.%
+ $ xt
+ 0 - 9
+ 35 - 1
+ 1b - 4
+ 32 - Sample one.
+ 7a - Sample two.
+ bd - 13
+ 77 - 3
+ c - 6
+ 9 - 7
+ b1 - 10
+ a - 5
+ 7b - 12
+ fa - 14
+ 17 - 11
+ fe - 8
+ d - 2
+
+Even more ambiguity:
+
+ $ xt 1test
+ $ xt 2test
+ $ xt 3test
+ $ xt 4test
+ $ xt 5test
+ $ xt 6test
+ $ xt 7test
+ $ xt 8test
+ $ xt 9test
+ $ xt 10test
+ $ xt 11test
+ $ xt 12test
+ $ xt 13test
+ $ xt 14test
+ $ xt
+ 0a - 9
+ 5 - 2test
+ d - 2
+ ee - 1test
+ fe - 8
+ 77 - 3
+ 2 - 5test
+ 14 - 6test
+ 35 - 1
+ 32 - Sample one.
+ 90 - 7
+ 8 - 12test
+ b1d - 10
+ 17 - 11
+ a1 - 7test
+ 7b - 12
+ c7 - 13test
+ 07 - 8test
+ 36 - 4test
+ 6 - 11test
+ 0e - 9test
+ b10 - 10test
+ 95 - 3test
+ fa - 14
+ 1b - 4
+ ef - 14test
+ 7a - Sample two.
+ bd - 13
+ c1 - 6
+ ac - 5
+ $ xt -f b1
+ The ID "b1" matches more than one task.%
+ $ xt -e b1
+ The ID "b1" matches more than one task.%
+ $ xt
+ 0a - 9
+ 5 - 2test
+ d - 2
+ ee - 1test
+ fe - 8
+ 77 - 3
+ 2 - 5test
+ 14 - 6test
+ 35 - 1
+ 32 - Sample one.
+ 90 - 7
+ 8 - 12test
+ b1d - 10
+ 17 - 11
+ a1 - 7test
+ 7b - 12
+ c7 - 13test
+ 07 - 8test
+ 36 - 4test
+ 6 - 11test
+ 0e - 9test
+ b10 - 10test
+ 95 - 3test
+ fa - 14
+ 1b - 4
+ ef - 14test
+ 7a - Sample two.
+ bd - 13
+ c1 - 6
+ ac - 5
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/filehandling.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,38 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Add a task file:
+
+ $ ls -a
+ .
+ ..
+ $ xt
+ $ ls -a
+ .
+ ..
+ $ xt Sample.
+ $ ls -a
+ .
+ ..
+ .test.done
+ test
+
+Finish a task without deleting:
+
+ $ xt -f a
+ $ ls -a
+ .
+ ..
+ .test.done
+ test
+
+Finish a task with deleting:
+
+ $ xt Another.
+ $ xt --delete-if-empty -f c
+ $ ls -a
+ .
+ ..
+ .test.done
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/finished.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,32 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Add some tasks:
+
+ $ xt Sample one.
+ $ xt Sample two.
+ $ xt Sample three.
+ $ xt Sample four.
+
+Finish and test .test.done:
+
+ $ xt -f 1
+ $ cat .test.done
+ Sample four. | id:1dd56b09a9ca0fdf4f2a8c0959a298098eb8f7de
+ $ xt -f 7
+ $ cat .test.done
+ Sample four. | id:1dd56b09a9ca0fdf4f2a8c0959a298098eb8f7de
+ Sample two. | id:7a4dc18c23f3b890602da09da1690ccfb4c87bd1
+ $ xt -f 3
+ $ cat .test.done
+ Sample four. | id:1dd56b09a9ca0fdf4f2a8c0959a298098eb8f7de
+ Sample one. | id:329950673481cb1c19102c982bfc63e745ab4a6f
+ Sample two. | id:7a4dc18c23f3b890602da09da1690ccfb4c87bd1
+ $ xt -f 9
+ $ cat .test.done
+ Sample four. | id:1dd56b09a9ca0fdf4f2a8c0959a298098eb8f7de
+ Sample one. | id:329950673481cb1c19102c982bfc63e745ab4a6f
+ Sample two. | id:7a4dc18c23f3b890602da09da1690ccfb4c87bd1
+ Sample three. | id:90cf0626ca134e0aa6453b3562dc1c8bb34f1568
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/manual.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,32 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Create a task file manually (no IDs):
+
+ $ cat >> test << EOF
+ > Sample one.
+ > Sample two.
+ > EOF
+ $ xt
+ 7 - Sample two.
+ 3 - Sample one.
+
+Add some manual tasks:
+
+ $ echo 'Custom one. | id: custom1' >> test
+ $ echo 'Custom two. | id: custom2' >> test
+ $ xt
+ 7 - Sample two.
+ custom1 - Custom one.
+ 3 - Sample one.
+ custom2 - Custom two.
+
+Rewrite the task file:
+
+ $ cat > test << EOF
+ > New.
+ > EOF
+ $ xt
+ 5 - New.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/padding.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,30 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --task-dir `pwd` --list test"
+
+Add tasks of varying width:
+
+ $ xt Short.
+ $ xt Longcat is long.
+
+Test paddings:
+
+ $ xt
+ 4 - Longcat is long.
+ 5 - Short.
+ $ cat test
+ Longcat is long. | id:4c623ab4df5cc1a10d32558768c2c21bddf2c053
+ Short. | id:5a7a65db2caa6313a70ceb75b1bd806f7879f6b7
+ $ cat >> test << EOF
+ > Long one. | id: long1
+ > Very long two. | id: long2
+ > EOF
+ $ xt -f 5
+ $ xt
+ 4 - Longcat is long.
+ long1 - Long one.
+ long2 - Very long two.
+ $ cat test
+ Longcat is long. | id:4c623ab4df5cc1a10d32558768c2c21bddf2c053
+ Long one. | id:long1
+ Very long two. | id:long2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/taskdirs.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,33 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --list test"
+
+Initialize multiple task directories:
+
+ $ mkdir beer
+ $ mkdir books
+ $ xt --task-dir beer Dogfish Head 120 minute IPA
+ $ xt --task-dir books Your Inner Fish
+ $ xt --task-dir beer
+ 7 - Dogfish Head 120 minute IPA
+ $ xt --task-dir books
+ 0 - Your Inner Fish
+
+Wrong directories:
+
+ $ xt --task-dir beer -f 0
+ The ID "0" does not match any task.%
+ $ xt --task-dir books -f 7
+ The ID "7" does not match any task.%
+ $ xt --task-dir beer
+ 7 - Dogfish Head 120 minute IPA
+ $ xt --task-dir books
+ 0 - Your Inner Fish
+
+Right directories:
+
+ $ xt --task-dir beer -f 7
+ $ xt --task-dir books -f 0
+ $ xt --task-dir beer
+ $ xt --task-dir books
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/tasklists.t Sun Oct 03 18:43:47 2010 -0400
@@ -0,0 +1,31 @@
+Setup:
+
+ $ alias xt="python $TESTDIR/../t.py --list `pwd`"
+
+Initialize multiple task lists:
+
+ $ xt --list beer Dogfish Head 120 minute IPA
+ $ xt --list books Your Inner Fish
+ $ xt --list beer
+ 7 - Dogfish Head 120 minute IPA
+ $ xt --list books
+ 0 - Your Inner Fish
+
+Wrong lists:
+
+ $ xt --list beer -f 0
+ The ID "0" does not match any task.%
+ $ xt --list books -f 7
+ The ID "7" does not match any task.%
+ $ xt --list beer
+ 7 - Dogfish Head 120 minute IPA
+ $ xt --list books
+ 0 - Your Inner Fish
+
+Right lists:
+
+ $ xt --list beer -f 7
+ $ xt --list books -f 0
+ $ xt --list beer
+ $ xt --list books
+