1. Sheng Mao
  2. issue-lit

Commits

Sheng Mao  committed 960e87d

tortoisehg uses an internal python.exe and it cannot find libs.
here, I introduce $PYTHONPATH and $PYTHONLIB.

  • Participants
  • Parent commits 6d0692c
  • Branches default

Comments (0)

Files changed (1)

File issue-lit.py

View file
 
 def issue(ui, repo, arg = None, **opts):
     ''' manage issues '''
+    #default
+    creation = False
+    close = False
+    useid = True
+    id = None
+    rev = None
+
+    #parse arg|opt
     if opts['new']:
         creation = True
-    if opts['close']:
+    elif opts['close']:
         close = True
-        
+
+    useid = True 
     if not opts['rev']:
-        if not arg:
-            raise Exception('should provide id or rev')
-        else:
-            id = arg
-            useid = True
+        id = arg
+        useid = True
     else:
         rev = int(opts['rev'])
         useid = False
 
-def issuenew(ui, repo, arg):
+    msg = opts['msg']
+
+    # dispatch commands
+    if creation:
+        issue_new(ui, repo, msg)
+    elif close:
+        issue_close(ui, repo, id, rev, useid)
+    else:
+        issue_list(ui, repo, id, rev, useid)
+
+def issue_new(ui, repo, msg):
+    if not msg:
+        raise Exception('a description is needed to create an issue')
+    # Tortoisehg uses an internal python.exe, so import the system's
+    import sys, os
+    sys.path.append(os.environ['PYTHONLIB'])
+    print sys.path
+    import uuid
+    id = uuid.uuid1()
+    commit_msg = "issue #%s:\n%s" % (id, msg)
     #commands.commit(ui, repo, 'issue', message="A test", addremove=True)
     pass
 
-def issuelist(ui, repo):
+def issue_list(ui, repo, id, rev, useid):
     pass
 
-def issueclose(ui, repo, arg, useid = True):
+def issue_close(ui, repo, id, rev, useid = True):
     pass
 
 cmdtable = {
     # "command-name": (function-call, options-list, help-string)
     'issue':
     (issue,
-        [('n', 'new', None , 'create a new issue'), # use None, opts['new'] = True|False
+        [('n', 'new', None , 'create a new issue'),
+         # use None, opts['new'] = True|False
          ('c', 'close', None, 'close the issue of the id'),
-         ('r', 'rev', '', 'use sequential number other than id') # use None, opts['rev'] = 'some arg'
-         ], 
+         # use None, opts['rev'] = 'some arg'
+         ('r', 'rev', '', 'use sequential number other than id'),
+         ('m', 'msg', '', 'additional message')
+         ],
 '''hg issue -n|--new "description"
 hg issue -c|--close id
 hg issue -c|--close -r|--rev no.'''