This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: just testing
Type: Stage:
Components: None Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: ajaksu2, gvanrossum, nobody
Priority: normal Keywords: patch

Created on 2000-06-22 16:26 by gvanrossum, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
None gvanrossum, 2000-06-22 16:26 None
Messages (9)
msg32809 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-22 16:26
 
msg32810 - (view) Author: Nobody/Anonymous (nobody) Date: 2000-07-13 08:02
Testing.
msg32811 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-22 16:26
didn't keep his finger on his nose
msg32812 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-22 16:28
does it stay?
msg32813 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-22 16:30
wish we could expunge the deleted ones
msg32814 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-22 16:37
closing this one again
msg83237 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-03-06 04:52
Reviewers: ,

Message:
While this is a test issue, the attached diff is a crude first draft of
a patched upload.py that makes linking to the Python Tracker a bit
easier.

Here's the command line and output:
$ python static/upload.py -R 400608 -F msg32813
Upload server: [...]
Loaded authentication cookies [...]
Issue created. URL: http://codereview.appspot.com/25073
Uploading base file for static/upload.py

And the help is:
$ python static/upload.py -h | tail -n5
   Link options:
     -R ROUNDUP, --roundup=ROUNDUP
                         Python tracker issue number to link with.
     -F FETCHDESCR, --fetch_descr=FETCHDESCR
                         Tracker file or message to fetch description
from.

I like it :)

Description:
wish we could expunge the deleted ones

Please review this at http://codereview.appspot.com/25073

Affected files:
   M     static/upload.py

Index: static/upload.py
===================================================================
--- static/upload.py	(revision 402)
+++ static/upload.py	(working copy)
@@ -61,7 +61,31 @@
  # Max size of patch or base file.
  MAX_UPLOAD_SIZE = 900 * 1024

+fields = {'issue':'title', 'msg':'content', 'file':'description', }
+def fetch_item(nodeid, kind='issue', tracker='http://bugs.python.org'):
+  query_tpl = [('@action', 'export_csv'), ('@filter', 'id'),
+  ('id', nodeid), ('@columns', fields[kind])]
+  item_url = '/%s?%s' % (kind, urllib.urlencode(query_tpl))
+  content = urllib.urlopen(tracker + item_url).read().split('\r\n')
+  if content[0] == 'title':
+    return '[issue%s] %s' % (nodeid, content[1].strip())
+  elif content[0] == 'content' or content[0] == 'description':
+    return content[1].strip()

+def fetch(nodeid):
+  try:
+    result = fetch_item(int(nodeid))
+  except ValueError:
+    if nodeid.startswith('msg'):
+      nodeid = nodeid.replace('msg', '')
+      result = fetch_item(int(nodeid), 'msg')
+    elif nodeid.startswith('file'):
+      nodeid = nodeid.replace('file', '')
+      result = fetch_item(int(nodeid), 'file')
+    else:
+      raise
+  return result
+
  def GetEmail(prompt):
    """Prompts the user for their email address and returns it.

@@ -453,6 +477,14 @@
  group.add_option("--send_mail", action="store_true",
                   dest="send_mail", default=False,
                   help="Send notification email to reviewers.")
+# Link options
+group = parser.add_option_group("Link options")
+group.add_option("-R", "--roundup", action="store", dest="roundup",
+                 metavar="ROUNDUP", default=None,
+                 help="Python tracker issue number to link with.")
+group.add_option("-F", "--fetch_descr", action="store", dest="fetch_descr",
+                 metavar="FETCHDESCR", default=None,
+                 help="Tracker file or message to fetch description from.")

  def GetRpcServer(options):
@@ -1291,7 +1323,10 @@
      prompt = "Message describing this patch set: "
    else:
      prompt = "New issue subject: "
-  message = options.message or raw_input(prompt).strip()
+  if options.roundup:
+    message = fetch(options.roundup)
+  else:
+    message = options.message or raw_input(prompt).strip()
    if not message:
      ErrorExit("A non-empty message is required")
    rpc_server = GetRpcServer(options)
@@ -1307,11 +1342,16 @@
        if "@" in reviewer and not reviewer.split("@")[1].count(".") == 1:
          ErrorExit("Invalid email address: %s" % reviewer)
      form_fields.append(("reviewers", options.reviewers))
+  tracker_email = 'report@bugs.python.org,'
    if options.cc:
      for cc in options.cc.split(','):
        if "@" in cc and not cc.split("@")[1].count(".") == 1:
          ErrorExit("Invalid email address: %s" % cc)
-    form_fields.append(("cc", options.cc))
+    if options.roundup:
+      cc = tracker_email + options.cc
+    form_fields.append(("cc", cc))
+  elif options.roundup:
+    form_fields.append(("cc", tracker_email[:-1]))
    description = options.description
    if options.description_file:
      if options.description:
@@ -1319,6 +1359,9 @@
      file = open(options.description_file, 'r')
      description = file.read()
      file.close()
+  elif options.fetch_descr:
+    # XXX Add error handling as above
+    description = fetch(options.fetch_descr)
    if description:
      form_fields.append(("description", description))
    # Send a hash of all the base file so the server can determine if a copy
msg83239 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2009-03-06 05:36
This is specific to the Python tracker, which Rietveld tries to avoid.
You could maintain this as a locally modified version, but a better
approach would be to make just enough changes to upload.py itself so
that you can write the rest of this script as a *wrapper* around
upload.py.  That's how the Chrome people manage their workflow, and
that's a generally recommended approach: the wrapper does the
project-specific stuff, passing everything to upload.py for the actual
interaction with Rietveld.

PS. What do you mean by "wish we could expunge the deleted ones"?  If
you delete a Rietveld issue it is really gone.  If you merely close it,
you can still delete it later.  But I'm probably missing something.

http://codereview.appspot.com/25073
msg83243 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-03-06 13:54
Thanks for the feedback, Guido!

gvanrossum wrote:
> You could maintain this as a locally modified version, but a better
> approach would be to make just enough changes to upload.py itself so
> that you can write the rest of this script as a *wrapper* around
> upload.py.

Yes, a wrapper is an option. MvL suggested a patch[1] and for this
initial implementation it makes things simpler. IIUC, in this case
upload.py would need no changes, as we simply populate existing
options with fetched values.

> PS. What do you mean by "wish we could expunge the deleted ones"?  If
> you delete a Rietveld issue it is really gone.  If you merely close it,
> you can still delete it later.  But I'm probably missing something.

Yes, you're missing the fact that you were the one saying  "wish we
could expunge the deleted ones" :)

 upload.py fetched that from http://bugs.python.org/msg32813 because I
told it to:
python static/upload.py -R 400608 -F msg32813

[1] http://mail.python.org/pipermail/tracker-discuss/2009-March/001875.html
History
Date User Action Args
2022-04-10 16:02:01adminsetgithub: 32453
2009-03-06 13:54:51ajaksu2setmessages: + msg83243
2009-03-06 05:36:28gvanrossumsetmessages: + msg83239
2009-03-06 04:52:55ajaksu2setnosy: + ajaksu2
messages: + msg83237
2000-06-22 16:26:21gvanrossumcreate