Index: src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/UploadAction.java	(revision 4378)
+++ src/org/openstreetmap/josm/actions/UploadAction.java	(working copy)
@@ -7,6 +7,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.util.LinkedList;
+import java.util.logging.Logger;
 
 import javax.swing.JOptionPane;
 
@@ -35,6 +36,8 @@
  * @author imi
  */
 public class UploadAction extends JosmAction{
+    private static Logger logger = Logger.getLogger(UploadAction.class.getName());
+
     /**
      * The list of upload hooks. These hooks will be called one after the other
      * when the user wants to upload data. Plugins can insert their own hooks here
@@ -160,6 +163,7 @@
             return;
 
         final UploadDialog dialog = UploadDialog.getUploadDialog();
+        dialog.setDefaultChangesetTags(layer.data.getChangeSetTags());
         dialog.setUploadedPrimitives(apiData);
         dialog.setVisible(true);
         if (dialog.isCanceled())
Index: src/org/openstreetmap/josm/tools/PlatformHookOsx.java
===================================================================
--- src/org/openstreetmap/josm/tools/PlatformHookOsx.java	(revision 4378)
+++ src/org/openstreetmap/josm/tools/PlatformHookOsx.java	(working copy)
@@ -30,11 +30,14 @@
         // Here we register callbacks for the menu entries in the system menu
         try {
             Class Ccom_apple_eawt_Application = Class.forName("com.apple.eawt.Application");
+            @SuppressWarnings("unchecked")
             Object Ocom_apple_eawt_Application = Ccom_apple_eawt_Application.getConstructor((Class[])null).newInstance((Object[])null);
             Class Ccom_apple_eawt_ApplicationListener = Class.forName("com.apple.eawt.ApplicationListener");
+            @SuppressWarnings("unchecked")
             Method MaddApplicationListener = Ccom_apple_eawt_Application.getDeclaredMethod("addApplicationListener", new Class[] { Ccom_apple_eawt_ApplicationListener });
             Object Oproxy = Proxy.newProxyInstance(PlatformHookOsx.class.getClassLoader(), new Class[] { Ccom_apple_eawt_ApplicationListener }, ivhandler);
             MaddApplicationListener.invoke(Ocom_apple_eawt_Application, new Object[] { Oproxy });
+            @SuppressWarnings("unchecked")
             Method MsetEnabledPreferencesMenu = Ccom_apple_eawt_Application.getDeclaredMethod("setEnabledPreferencesMenu", new Class[] { boolean.class });
             MsetEnabledPreferencesMenu.invoke(Ocom_apple_eawt_Application, new Object[] { Boolean.TRUE });
         } catch (Exception ex) {
Index: src/org/openstreetmap/josm/gui/io/UploadDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/io/UploadDialog.java	(revision 4378)
+++ src/org/openstreetmap/josm/gui/io/UploadDialog.java	(working copy)
@@ -17,6 +17,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Logger;
 
 import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
@@ -52,6 +53,8 @@
  *
  */
 public class UploadDialog extends JDialog implements PropertyChangeListener, PreferenceChangedListener{
+    private static Logger logger = Logger.getLogger(UploadDialog.class.getName());
+
     /**  the unique instance of the upload dialog */
     static private UploadDialog uploadDialog;
 
@@ -300,6 +303,14 @@
 
     public void setDefaultChangesetTags(Map<String, String> tags) {
         pnlTagSettings.setDefaultTags(tags);
+
+        // The following code does not seem to actually work.  JOSM ignores the comment given.
+        for (String key: tags.keySet()) {
+            if( key.equals("comment")) {
+                logger.info("TODO: bug, this tag is not working. comment=" +tags.get(key));
+                pnlTagSettings.setUploadComment(tags.get(key));
+            }
+        }
     }
 
     /**
Index: src/org/openstreetmap/josm/io/OsmImporter.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmImporter.java	(revision 4378)
+++ src/org/openstreetmap/josm/io/OsmImporter.java	(working copy)
@@ -8,6 +8,7 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.logging.Logger;
 
 import javax.swing.SwingUtilities;
 
@@ -19,6 +20,7 @@
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 
 public class OsmImporter extends FileImporter {
+    private static Logger logger = Logger.getLogger(OsmImporter.class.getName());
 
     public OsmImporter() {
         super(new ExtensionFileFilter("osm,xml", "osm", tr("OSM Server Files") + " (*.osm *.xml)"));
@@ -41,6 +43,7 @@
     protected void importData(InputStream in, File associatedFile) throws IllegalDataException {
         DataSet dataSet = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
         final OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile);
+
         // FIXME: remove UI stuff from IO subsystem
         //
         Runnable uiStuff = new Runnable() {
Index: src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- src/org/openstreetmap/josm/io/OsmReader.java	(revision 4378)
+++ src/org/openstreetmap/josm/io/OsmReader.java	(working copy)
@@ -112,7 +112,7 @@
         /**
          * The current osm primitive to be read.
          */
-        private OsmPrimitive currentPrimitive;
+        private OsmPrimitive currentPrimitive = null;
         private long currentExternalId;
         private String generator;
 
@@ -134,6 +134,12 @@
                     generator = atts.getValue("generator");
                     ds.setVersion(v);
 
+                    // JOSM specific extension to the file format.  This is for scripts or bots that build
+                    // a .osm file for human review.  Here the script or bot can pre-set values for
+                    // later upload in the changeset.
+                } else if (qName.equals("changeset")) {
+                    currentPrimitive = null;    // flag for tag parser below
+
                 } else if (qName.equals("bounds")) {
                     // new style bounds.
                     String minlon = atts.getValue("minlon");
@@ -259,15 +265,18 @@
                         list.add(emd);
                     }
 
-                    // ---- PARSING TAGS (applicable to all objects) ----
-
+                    // ---- PARSING TAGS (applicable to all objects & changesets) ----
                 } else if (qName.equals("tag")) {
                     String key = atts.getValue("k");
                     String value = atts.getValue("v");
                     if (key == null || value == null) {
                         throwException(tr("Missing key or value attribute in tag."));
                     }
-                    currentPrimitive.put(key.intern(), value.intern());
+                    if( currentPrimitive == null) {
+                        ds.addChangeSetTag(key.intern(), value.intern() );  // changeset
+                    } else {
+                        currentPrimitive.put(key.intern(), value.intern()); // node/way/relation
+                    }
 
                 } else {
                     System.out.println(tr("Undefined element ''{0}'' found in input stream. Skipping.", qName));
@@ -452,8 +461,8 @@
             }
             w.setNodes(wayNodes);
             if (w.hasIncompleteNodes()) {
-                  System.out.println(tr("Way {0} with {1} nodes has incomplete nodes because at least one node was missing in the loaded data.",
-                          externalWayId, w.getNodesCount()));
+                System.out.println(tr("Way {0} with {1} nodes has incomplete nodes because at least one node was missing in the loaded data.",
+                        externalWayId, w.getNodesCount()));
             }
             ds.addPrimitive(w);
         }
Index: src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 4378)
+++ src/org/openstreetmap/josm/data/osm/DataSet.java	(working copy)
@@ -206,6 +206,18 @@
         this.version = version;
     }
 
+    /*
+     * Holding bin for changeset tag information, to be applied when or if this is ever uploaded.
+     */
+    //private HashMap changeSetTags = new HashMap();
+    private Map<String, String> changeSetTags = new HashMap<String, String>();
+    public Map<String, String> getChangeSetTags() {
+        return changeSetTags;
+    }
+    public void addChangeSetTag(String k, String v) {
+        this.changeSetTags.put(k,v);
+    }
+
     /**
      * All nodes goes here, even when included in other data (ways etc). This enables the instant
      * conversion of the whole DataSet by iterating over this data structure.
