59c23bd04099 — Michael Diamond@Remote 0.5.3 10 years ago
Fixed bugs, increased minor version number.
3 files changed, 63 insertions(+), 20 deletions(-)

M .bugs/bugs
A => .bugs/details/1364b6de76f3b532867da63223a45d429ba08a46.txt
M src/b.py
M .bugs/bugs +7 -7
@@ 1,7 1,7 @@ 
-should output prefix of newly added bug if possible                               | owner:Michael, open:True, id:1364b6de76f3b532867da63223a45d429ba08a46, time:1277687762.41
-list command reports no such file when bugs dir doesn't exist                     | owner:Michael Diamond, open:True, id:21d24c2b58102a88fa7d6ee78cd190c5b10dafa1, time:1278106675.1
-Need to add bug files automatically                                               | owner:Michael, open:True, id:27e00056bfc988ab41c023b5c0a9db9f5e9fa527, time:1277581398.52
-add version command to report what version of b we're using                       | owner:Michael Diamond, open:True, id:4982d102b75bda27e54c16293350ff561c248921, time:1278106694.44
-Files should be added to mercurial at the end, not the begining of the call       | owner:Michael, open:True, id:6ba1ae74c48a6fd84c5d0698fa8169a28e88b343, time:1277680246.97
-Bugs with no details but a details file should act like there is not details file | owner:Michael, open:True, id:9f771c1b687a119eb8e6f9a8443f2c0dde30776b, time:1277680715.42
-Calling hg b details with no id throws an exception                               | owner:Michael, open:True, id:d33d694650de726f70ff49003835fe6cc61d8d6d, time:1277687733.59
+Should output prefix of newly added bug if possible                               | owner:Michael, open:True, id:1364b6de76f3b532867da63223a45d429ba08a46, time:1277687762.41
+list command reports no such file when bugs dir doesn't exist                     | owner:Michael Diamond, open:False, id:21d24c2b58102a88fa7d6ee78cd190c5b10dafa1, time:1278106675.1
+Need to add bug files automatically                                               | owner:Michael, open:False, id:27e00056bfc988ab41c023b5c0a9db9f5e9fa527, time:1277581398.52
+add version command to report what version of b we're using                       | owner:Michael Diamond, open:False, id:4982d102b75bda27e54c16293350ff561c248921, time:1278106694.44
+Files should be added to mercurial at the end, not the begining of the call       | owner:Michael, open:False, id:6ba1ae74c48a6fd84c5d0698fa8169a28e88b343, time:1277680246.97
+Bugs with no details but a details file should act like there is not details file | owner:Michael, open:False, id:9f771c1b687a119eb8e6f9a8443f2c0dde30776b, time:1277680715.42
+Calling commands that expect an ID without passing an ID throws an exception      | owner:Michael, open:False, id:d33d694650de726f70ff49003835fe6cc61d8d6d, time:1277687733.59

          
A => .bugs/details/1364b6de76f3b532867da63223a45d429ba08a46.txt +29 -0
@@ 0,0 1,29 @@ 
+# Lines starting with '#' and sections without content
+# are not displayed by a call to 'details'
+#
+[paths]
+# Paths related to this bug.
+# suggested format: REPO_PATH:LINENUMBERS
+
+
+[details]
+# Additional details
+
+
+[expected]
+# The expected result
+
+
+[actual]
+# What happened instead
+
+
+[reproduce]
+# Reproduction steps
+
+
+[comments]
+# Comments and updates - leave your name
+
+On: Thursday, July 22 2010 03:50PM
+Improved b to output a generic (10 char) prefix of the bug, but it would be very nice if it output the current, proper prefix.  This would likely involve a new function to calculate an individual ID's prefix.
  No newline at end of file

          
M src/b.py +27 -13
@@ 9,8 9,6 @@ 
 
 """ A lightweight distributed bug tracker for Mercurial based projects
 
-Version 0.5.2 - Feature Complete Beta
-
 "The only way to make your bug list prettier is to fix some damn bugs."
 
 b is a lightweight distributed bug tracker.  Stripped of many of the

          
@@ 44,6 42,11 @@ from mercurial.i18n import _
 from mercurial import hg,commands
 
 #
+# Version
+#
+version = _("b Version 0.5.3 - Feature Complete Beta built 7-22-10")
+
+#
 # Exceptions
 #
 class InvalidDetailsFile(Exception):

          
@@ 369,6 372,7 @@ class BugsDict(object):
             if not task_id in self.bugs:
                 break
         self.bugs[task_id] = {'id': task_id, 'open': 'True', 'owner': self.user, 'text': text, 'time': time.time()}
+        return _("Added bug %s...") % task_id[:10]
     
     def rename(self, prefix, text):
         """Renames the bug

          
@@ 443,12 447,12 @@ class BugsDict(object):
             
             text = re.sub("\[\w+\]\s*$", "", text)
         else:
-            text = 'No Details File Found.'
+            text = _('No Details File Found.')
         
-        header = "Title: %s\nID: %s\n" % (task['text'],task['id'])
+        header = _("Title: %s\nID: %s\n") % (task['text'],task['id'])
         if task['owner'] != '':
-            header = header + ("Owned By: %s\n" % task['owner'])
-        header = header + ("Filed On: %s\n\n" % _datetime(task['time']))
+            header = header + (_("Owned By: %s\n") % task['owner'])
+        header = header + (_("Filed On: %s\n\n") % _datetime(task['time']))
         text = header + text
         
         return text.strip()

          
@@ 520,9 524,10 @@ class BugsDict(object):
 #
 def _track(dir,ui,repo):
     """ Adds new files to Mercurial. """
-    ui.pushbuffer()
-    commands.add(ui,repo,dir)
-    ui.popbuffer()
+    if os.path.exists(dir):
+		ui.pushbuffer()
+		commands.add(ui,repo,dir)
+		ui.popbuffer()
 
 def cmd(ui,repo,cmd = '',*args,**opts):
     """ Distributed Bug Tracker For Mercurial

          
@@ 574,8 579,13 @@ def cmd(ui,repo,cmd = '',*args,**opts):
         
     id prefix
         Takes a prefix and returns the full id of that bug
+    
+    version
+        Outputs the version number of b being used in this repository
     """
     text = (' '.join(args)).strip();
+    id = ''
+    subtext = ''
     if len(args) > 0:
         id = args[0]
     if len(args) > 1:

          
@@ 589,9 599,8 @@ def cmd(ui,repo,cmd = '',*args,**opts):
         path = repo.root
         os.chdir(path)
         bd = BugsDict(bugsdir,user)
-        _track(bugsdir,ui,repo)
         if cmd == 'add':
-            bd.add(text)
+            ui.write(bd.add(text)+'\n')
             bd.write()
         elif cmd == 'rename':
             bd.rename(id, subtext)

          
@@ 599,7 608,7 @@ def cmd(ui,repo,cmd = '',*args,**opts):
         elif cmd == 'users':
             ui.write(bd.users()+'\n')
         elif cmd == 'assign':
-            ui.write(bd.assign(id, subtext, opts['force']))
+            ui.write(bd.assign(id, subtext, opts['force'])+'\n')
             bd.write()
         elif cmd == 'details':
             ui.write(bd.details(id)+'\n')

          
@@ 613,12 622,17 @@ def cmd(ui,repo,cmd = '',*args,**opts):
         elif cmd == 'reopen':
             bd.reopen(id)
             bd.write()
-        elif cmd == 'list':
+        elif cmd == 'list' or cmd == '':
             ui.write(bd.list(not opts['resolved'], opts['owner'], opts['grep'])+'\n')
         elif cmd == 'id':
             ui.write(bd.id(id)+'\n')
+        elif cmd == 'version':
+            ui.write(version+'\n')
         else:
             raise UnknownCommand(cmd)
+		
+		# Add all new files to Mercurial - does not commit
+        _track(bugsdir,ui,repo)
     
     except InvalidDetailsFile, e:
         ui.warn(_("The path where %s's details should be is blocked and cannot be created.  Are there directories in the details dir?\n"))