Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h	(revision 13821)
+++ subversion/include/svn_wc.h	(working copy)
@@ -543,7 +543,9 @@
   svn_wc_notify_failed_lock,
 
   /** @since New in 1.2.  Failed to unlock a path. */
-  svn_wc_notify_failed_unlock
+  svn_wc_notify_failed_unlock,
+
+  svn_wc_notify_status_xml_completed
 } svn_wc_notify_action_t;
 
 
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h	(revision 13821)
+++ subversion/include/svn_client.h	(working copy)
@@ -329,6 +329,7 @@
                                 void *baton,
                                 apr_pool_t *pool);
 
+
 /** Callback type used by svn_client_blame() to notify the caller
  * that line @a line_no of the blamed file was last changed in
  * @a revision by @a author on @a date, and that the contents were
@@ -825,6 +826,20 @@
                     apr_pool_t *pool);
 
 
+svn_error_t *
+svn_client_status3 (svn_revnum_t *result_rev,
+                    const char *path,
+                    svn_opt_revision_t *revision,
+                    svn_wc_status_func2_t status_func,
+                    void *status_baton,
+                    svn_boolean_t recurse,
+                    svn_boolean_t get_all,
+                    svn_boolean_t update,
+                    svn_boolean_t no_ignore,
+                    svn_boolean_t ignore_externals,
+                    svn_boolean_t xml,
+                    svn_client_ctx_t *ctx,
+                    apr_pool_t *pool);
 /**
  * @deprecated Provided for backward compatibility with the 1.1 API.
  *
Index: subversion/libsvn_client/status.c
===================================================================
--- subversion/libsvn_client/status.c	(revision 13821)
+++ subversion/libsvn_client/status.c	(working copy)
@@ -188,7 +188,176 @@
 
 /*** Public Interface. ***/
 
+svn_error_t *
+svn_client_status3 (svn_revnum_t *result_rev,
+                    const char *path,
+                    svn_opt_revision_t *revision,
+                    svn_wc_status_func2_t status_func,
+                    void *status_baton,
+                    svn_boolean_t recurse,
+                    svn_boolean_t get_all,
+                    svn_boolean_t update,
+                    svn_boolean_t no_ignore,
+                    svn_boolean_t ignore_externals,
+                    svn_boolean_t xml,
+                    svn_client_ctx_t *ctx,
+                    apr_pool_t *pool)
+{
+  svn_wc_adm_access_t *anchor_access, *target_access;
+  svn_wc_traversal_info_t *traversal_info = svn_wc_init_traversal_info (pool);
+  const char *anchor, *target;
+  const svn_delta_editor_t *editor;
+  void *edit_baton, *set_locks_baton;
+  const svn_wc_entry_t *entry;
+  struct status_baton sb;
+  svn_revnum_t edit_revision = SVN_INVALID_REVNUM;
 
+  sb.real_status_func = status_func;
+  sb.real_status_baton = status_baton;
+  sb.deleted_in_repos = FALSE;
+
+  SVN_ERR (svn_wc_adm_open_anchor (&anchor_access, &target_access, &target,
+                                   path, FALSE, recurse ? -1 : 1,
+                                   ctx->cancel_func, ctx->cancel_baton,
+                                   pool));
+  anchor = svn_wc_adm_access_path (anchor_access);
+
+  /* Get the status edit, and use our wrapping status function/baton
+     as the callback pair. */
+  SVN_ERR (svn_wc_get_status_editor2 (&editor, &edit_baton, &set_locks_baton,
+                                      &edit_revision, anchor_access, target,
+                                      ctx->config, recurse, get_all, no_ignore,
+                                      tweak_status, &sb, ctx->cancel_func,
+                                      ctx->cancel_baton, traversal_info,
+                                      pool));
+
+  /* If we want to know about out-of-dateness, we crawl the working copy and
+     let the RA layer drive the editor for real.  Otherwise, we just close the
+     edit.  :-) */ 
+  if (update)
+    {
+      svn_ra_session_t *ra_session;
+      const char *URL;
+      svn_node_kind_t kind;
+
+      /* Get full URL from the ANCHOR. */
+      SVN_ERR (svn_wc_entry (&entry, anchor, anchor_access, FALSE, pool));
+      if (! entry)
+        return svn_error_createf
+          (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
+           _("'%s' is not under version control"),
+           svn_path_local_style (anchor, pool));
+      if (! entry->url)
+        return svn_error_createf
+          (SVN_ERR_ENTRY_MISSING_URL, NULL,
+           _("Entry '%s' has no URL"),
+           svn_path_local_style (anchor, pool));
+      URL = apr_pstrdup (pool, entry->url);
+
+      /* Open a repository session to the URL. */
+      SVN_ERR (svn_client__open_ra_session (&ra_session, URL, anchor,
+                                            anchor_access, NULL, TRUE, TRUE, 
+                                            ctx, pool));
+
+      /* Verify that URL exists in HEAD.  If it doesn't, this can save
+         us a whole lot of hassle; if it does, the cost of this
+         request should be minimal compared to the size of getting
+         back the average amount of "out-of-date" information. */
+      SVN_ERR (svn_ra_check_path (ra_session, "", SVN_INVALID_REVNUM,
+                                  &kind, pool));
+      if (kind == svn_node_none)
+        {
+          /* Our status target does not exist in HEAD of the
+             repository.  If we're just adding this thing, that's
+             fine.  But if it was previously versioned, then it must
+             have been deleted from the repository. */
+          if (entry->schedule != svn_wc_schedule_add)
+            sb.deleted_in_repos = TRUE;
+
+          /* And now close the edit. */
+          SVN_ERR (editor->close_edit (edit_baton, pool));
+        }
+      else
+        {
+          svn_revnum_t revnum;
+          report_baton_t rb;
+            
+          if (revision->kind == svn_opt_revision_head)
+            {
+              /* Cause the revision number to be omitted from the request,
+                 which implies HEAD. */
+              revnum = SVN_INVALID_REVNUM;
+            }
+          else
+            {
+              /* Get a revision number for our status operation. */
+              SVN_ERR (svn_client__get_revision_number
+                       (&revnum, ra_session, revision, target, pool));
+            }
+
+          /* Do the deed.  Let the RA layer drive the status editor. */
+          SVN_ERR (svn_ra_do_status (ra_session, &rb.wrapped_reporter,
+                                     &rb.wrapped_report_baton,
+                                     target, revnum, recurse, editor, 
+                                     edit_baton, pool));
+
+          /* Init the report baton. */
+          rb.ancestor = apr_pstrdup (pool, URL);
+          rb.set_locks_baton = set_locks_baton;
+          rb.ctx = ctx;
+          rb.pool = pool;
+          
+          /* Drive the reporter structure, describing the revisions
+             within PATH.  When we call reporter->finish_report,
+             EDITOR will be driven to describe differences between our
+             working copy and HEAD. */
+          SVN_ERR (svn_wc_crawl_revisions2 (path, target_access,
+                                            &lock_fetch_reporter, &rb, FALSE,
+                                            recurse, FALSE, NULL, NULL, NULL,
+                                            pool));
+        }
+    }
+  else
+    {
+      SVN_ERR (editor->close_edit (edit_baton, pool));
+    }
+
+  if (ctx->notify_func2 && update)
+    {
+      svn_wc_notify_t *notify;
+
+      if (xml)
+        notify = svn_wc_create_notify (path, svn_wc_notify_status_xml_completed, pool);
+      else
+        notify = svn_wc_create_notify (path, svn_wc_notify_status_completed, pool);
+
+      notify->revision = edit_revision;
+      (ctx->notify_func2) (ctx->notify_baton2, notify, pool);
+    }
+  /* If the caller wants the result revision, give it to them. */
+  if (result_rev)
+    *result_rev = edit_revision;
+
+  /* Close the access baton here, as svn_client__do_external_status()
+     calls back into this function and thus will be re-opening the
+     working copy. */
+  SVN_ERR (svn_wc_adm_close (anchor_access));
+
+  /* If there are svn:externals set, we don't want those to show up as
+     unversioned or unrecognized, so patch up the hash.  If caller wants
+     all the statuses, we will change unversioned status items that
+     are interesting to an svn:externals property to
+     svn_wc_status_unversioned, otherwise we'll just remove the status
+     item altogether. */
+  if (recurse && (! ignore_externals))
+    SVN_ERR (svn_client__do_external_status (traversal_info, status_func,
+                                             status_baton, get_all, update,
+                                             no_ignore, ctx, pool));
+
+  return SVN_NO_ERROR;
+}
+
+
 svn_error_t *
 svn_client_status2 (svn_revnum_t *result_rev,
                     const char *path,
Index: subversion/clients/cmdline/cl.h
===================================================================
--- subversion/clients/cmdline/cl.h	(revision 13821)
+++ subversion/clients/cmdline/cl.h	(working copy)
@@ -249,6 +249,7 @@
    as broken WC locks. */
 svn_error_t *svn_cl__print_status (const char *path,
                                    svn_wc_status2_t *status,
+                                   svn_boolean_t xml_mode,
                                    svn_boolean_t detailed,
                                    svn_boolean_t show_last_committed,
                                    svn_boolean_t skip_unrecognized,
Index: subversion/clients/cmdline/status.c
===================================================================
--- subversion/clients/cmdline/status.c	(revision 13821)
+++ subversion/clients/cmdline/status.c	(working copy)
@@ -24,6 +24,7 @@
 #include "svn_cmdline.h"
 #include "svn_wc.h"
 #include "svn_path.h"
+#include "svn_xml.h"
 #include "cl.h"
 
 
@@ -51,10 +52,135 @@
     }
 }
 
+
+
+/* Print status in XML format to standard console */
+static svn_error_t *
+print_statents_xml (apr_pool_t *pool,
+                    char item_stat,
+                    char prop_stat,
+                    char locked,
+                    char copied,
+                    char switched,
+                    char reposlock,
+                    char ood_stat,
+                    const char *working_rev,
+                    const char *commit_rev,
+                    const char *commit_author,
+                    const char *path)
+{
+  char statcode[2] = {'\0', '\0'};
+  svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
+
+  /* "<entry ...>" */
+  svn_xml_make_open_tag (&sb, pool, svn_xml_normal, "entry",
+                           "file", path[0] == '\0' ? "." : path,
+                           NULL);
+  /* <item-status>x</item-status> */
+  statcode[0] = item_stat;
+  svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                         "item-status", NULL);
+  svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+  svn_xml_make_close_tag (&sb, pool, "item-status");
+
+  /* <prop-status>x</prop-status> */
+  statcode[0] = prop_stat;
+  svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                         "prop-status", NULL);
+  svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+  svn_xml_make_close_tag (&sb, pool, "prop-status");
+
+  /* <locked>x</locked> */
+  if (locked)
+    {
+      statcode[0] = locked;
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "locked", NULL);
+      svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+      svn_xml_make_close_tag (&sb, pool, "locked");
+    }
+
+  /* <scheduled>x</scheduled> */
+  if (copied)
+    {
+      statcode[0] = copied;
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "scheduled", NULL);
+      svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+      svn_xml_make_close_tag (&sb, pool, "scheduled");
+    }
+
+  /* <switched>x</switched> */
+  if (switched)
+    {
+      statcode[0] = switched;
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "switched", NULL);
+      svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+      svn_xml_make_close_tag (&sb, pool, "switched");
+    }
+
+  /* <repos-lock>x</repos-lock> */
+  if (reposlock)
+    {
+      statcode[0] = reposlock; 
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "repos-lock", NULL);
+      svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+      svn_xml_make_close_tag (&sb, pool, "repos-lock");
+    }
+ 
+  /* <out-of-date>x</out-of-date> */
+  if (ood_stat)
+    {
+      statcode[0] = ood_stat; 
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "out-of-date", NULL);
+      svn_xml_escape_cdata_cstring (&sb, statcode, pool);
+      svn_xml_make_close_tag (&sb, pool, "out-of-date");
+    }
+
+  /* <revision>xx</revision> */
+  if (working_rev)
+    {
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "revision", NULL);
+      svn_xml_escape_cdata_cstring (&sb, working_rev, pool);
+      svn_xml_make_close_tag (&sb, pool, "revision");
+    }
+
+  /* <rev-last-commit>xx</rev-last-commit> */
+  if (commit_rev)
+    {
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "rev-last-commit", NULL);
+      svn_xml_escape_cdata_cstring (&sb, commit_rev, pool);
+      svn_xml_make_close_tag (&sb, pool, "rev-last-commit");
+    }
+
+  /* <author-last-commit>xx</author-last-commit> */
+  if (commit_author)
+    {
+      svn_xml_make_open_tag (&sb, pool, svn_xml_protect_pcdata,
+                             "author-last-commit", NULL);
+      svn_xml_escape_cdata_cstring (&sb, commit_author, pool);
+      svn_xml_make_close_tag (&sb, pool, "author-last-commit");
+    }
+
+  /* "</entry>" */
+  svn_xml_make_close_tag (&sb, pool, "entry");
+
+  SVN_ERR (svn_cl__error_checked_fputs (sb->data, stdout));
+
+  return SVN_NO_ERROR;
+}
+
+
 /* Print STATUS and PATH in a format determined by DETAILED and
    SHOW_LAST_COMMITTED. */
 static svn_error_t *
 print_status (const char *path,
+              svn_boolean_t xml_mode,
               svn_boolean_t detailed,
               svn_boolean_t show_last_committed,
               svn_boolean_t repos_locks,
@@ -123,10 +249,42 @@
           else
             commit_author = "";
 
+          if (xml_mode)
+            SVN_ERR
+              (print_statents_xml (pool,
+                                   generate_status_code(status->text_status),
+                                   generate_status_code (status->prop_status),
+                                   status->locked ? 'L' : ' ',
+                                   status->copied ? '+' : ' ',
+                                   status->switched ? 'S' : ' ',
+                                   lock_status,
+                                   ood_status,
+                                   working_rev,
+                                   commit_rev,
+                                   commit_author,
+                                   path));
+
+          else
+            SVN_ERR
+              (svn_cmdline_printf (pool,
+                                   "%c%c%c%c%c%c %c   %6s   %6s %-12s %s\n",
+                                   generate_status_code(status->text_status),
+                                   generate_status_code (status->prop_status),
+                                   status->locked ? 'L' : ' ',
+                                   status->copied ? '+' : ' ',
+                                   status->switched ? 'S' : ' ',
+                                   lock_status,
+                                   ood_status,
+                                   working_rev,
+                                   commit_rev,
+                                   commit_author,
+                                   path));
+        }
+      else
+        {
           SVN_ERR
-            (svn_cmdline_printf (pool,
-                                 "%c%c%c%c%c%c %c   %6s   %6s %-12s %s\n",
-                                 generate_status_code(status->text_status),
+            (svn_cmdline_printf (pool, "%c%c%c%c%c%c %c   %6s   %s\n",
+                                 generate_status_code (status->text_status),
                                  generate_status_code (status->prop_status),
                                  status->locked ? 'L' : ' ',
                                  status->copied ? '+' : ' ',
@@ -134,42 +292,32 @@
                                  lock_status,
                                  ood_status,
                                  working_rev,
-                                 commit_rev,
-                                 commit_author,
                                  path));
         }
-      else
-        SVN_ERR
-          (svn_cmdline_printf (pool, "%c%c%c%c%c%c %c   %6s   %s\n",
-                               generate_status_code (status->text_status),
-                               generate_status_code (status->prop_status),
-                               status->locked ? 'L' : ' ',
-                               status->copied ? '+' : ' ',
-                               status->switched ? 'S' : ' ',
-                               lock_status,
-                               ood_status,
-                               working_rev,
-                               path));
     }
   else
-    SVN_ERR
-      (svn_cmdline_printf (pool, "%c%c%c%c%c%c %s\n",
-                           generate_status_code (status->text_status),
-                           generate_status_code (status->prop_status),
-                           status->locked ? 'L' : ' ',
-                           status->copied ? '+' : ' ',
-                           status->switched ? 'S' : ' ',
-                           ((status->entry && status->entry->lock_token)
-                            ? 'K' : ' '),
-                           path));
-
+    {
+      SVN_ERR
+        (svn_cmdline_printf (pool, "%c%c%c%c%c%c %s\n",
+                             generate_status_code (status->text_status),
+                             generate_status_code (status->prop_status),
+                             status->locked ? 'L' : ' ',
+                             status->copied ? '+' : ' ',
+                             status->switched ? 'S' : ' ',
+                             ((status->entry && status->entry->lock_token)
+                              ? 'K' : ' '),
+                             path));
+    }
   return SVN_NO_ERROR;
 }
 
+
+
 /* Called by status-cmd.c */
 svn_error_t *
 svn_cl__print_status (const char *path,
                       svn_wc_status2_t *status,
+                      svn_boolean_t xml_mode,
                       svn_boolean_t detailed,
                       svn_boolean_t show_last_committed,
                       svn_boolean_t skip_unrecognized,
@@ -182,7 +330,7 @@
           && status->repos_text_status == svn_wc_status_none))
     return SVN_NO_ERROR;
 
-  return print_status (svn_path_local_style (path, pool),
+  return print_status (svn_path_local_style (path, pool), xml_mode,
                        detailed, show_last_committed, repos_locks, status,
                        pool);
 }
Index: subversion/clients/cmdline/notify.c
===================================================================
--- subversion/clients/cmdline/notify.c	(revision 13821)
+++ subversion/clients/cmdline/notify.c	(working copy)
@@ -29,6 +29,7 @@
 #include "svn_cmdline.h"
 #include "svn_pools.h"
 #include "svn_path.h"
+#include "svn_xml.h"
 #include "cl.h"
 
 #include "svn_private_config.h"
@@ -363,7 +364,23 @@
     case svn_wc_notify_failed_unlock:
       svn_handle_error (n->err, stderr, FALSE);
       break;
+    case svn_wc_notify_status_xml_completed:
+      if (SVN_IS_VALID_REVNUM (n->revision))
+        {
+          const char *staton_rev;
+          svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
+          staton_rev = apr_psprintf (pool, "%ld", n->revision);
+          /* "<status-against ...>" */
+          svn_xml_make_open_tag (&sb, pool, svn_xml_normal,
+                                 "status-against", "rev", staton_rev, NULL);
 
+          /* "</status-against>" */
+          svn_xml_make_close_tag (&sb, pool, "status-against");
+
+          svn_cl__error_checked_fputs (sb->data, stdout);
+        }
+      break;
+
     default:
       break;
     }
Index: subversion/clients/cmdline/main.c
===================================================================
--- subversion/clients/cmdline/main.c	(revision 13821)
+++ subversion/clients/cmdline/main.c	(working copy)
@@ -672,7 +672,8 @@
      "                 965       687 joe          wc/zig.c\n"
      "    Head revision:   981\n"),
     { 'u', 'v', 'N', 'q', svn_cl__no_ignore_opt, SVN_CL__AUTH_OPTIONS, 
-      svn_cl__config_dir_opt, svn_cl__ignore_externals_opt} },
+      svn_cl__config_dir_opt, svn_cl__ignore_externals_opt, svn_cl__xml_opt,
+      svn_cl__incremental_opt} },
   
   { "switch", svn_cl__switch, {"sw"},
     N_("Update the working copy to a different URL.\n"
@@ -1174,6 +1175,11 @@
         }
     }
 
+  /* If we're running the `status' subcommand with xml option, then 
+     verbose or detailed mode is activated */
+  if ((opt_state.xml) && subcommand->cmd_func == svn_cl__status)
+    opt_state.verbose = TRUE;
+
   /* if we're running a command that could result in a commit, verify
      that any log message we were given on the command line makes
      sense (unless we've also been instructed not to care). */
Index: subversion/clients/cmdline/status-cmd.c
===================================================================
--- subversion/clients/cmdline/status-cmd.c	(revision 13821)
+++ subversion/clients/cmdline/status-cmd.c	(working copy)
@@ -26,8 +26,12 @@
 #include "svn_client.h"
 #include "svn_error.h"
 #include "svn_pools.h"
+#include "svn_xml.h"
 #include "cl.h"
 
+#include "svn_private_config.h"
+
+
 
 /*** Code. ***/
 
@@ -43,9 +47,36 @@
 
   svn_boolean_t had_print_error;  /* To avoid printing lots of errors if we get
                                      errors while printing to stdout */
+  svn_boolean_t xml_mode;
 };
 
 
+/* Prints XML header */
+static svn_error_t *
+print_header_xml (apr_pool_t *pool)
+{
+  svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
+  /* <?xml version="1.0" encoding="utf-8"?> */
+  svn_xml_make_header (&sb, pool);
+
+  /* "<status>" */
+  svn_xml_make_open_tag (&sb, pool, svn_xml_normal, "status", NULL);
+
+  return svn_cl__error_checked_fputs (sb->data, stdout);
+}
+
+
+/* Prints XML footer */
+static svn_error_t *
+print_footer_xml (apr_pool_t *pool)
+{
+  svn_stringbuf_t *sb = svn_stringbuf_create ("", pool);
+  /* "</status>" */
+  svn_xml_make_close_tag (&sb, pool, "status");
+  return svn_cl__error_checked_fputs (sb->data, stdout);
+}
+
+
 /* A status callback function for printing STATUS for PATH. */
 static void
 print_status (void *baton,
@@ -55,8 +86,8 @@
   struct status_baton *sb = baton;
   svn_error_t *err;
   
-  err = svn_cl__print_status (path, status, sb->detailed,
-                              sb->show_last_committed,
+  err = svn_cl__print_status (path, status, sb->xml_mode, 
+                              sb->detailed, sb->show_last_committed,
                               sb->skip_unrecognized, sb->repos_locks,
                               sb->pool);
 
@@ -104,6 +135,23 @@
 
   sb.had_print_error = FALSE;
 
+  if (opt_state->xml)
+    {
+      /* If output is not incremental, output the XML header and wrap
+         everything in a top-level element. This makes the output in
+         its entirety a well-formed XML document. */
+      if (! opt_state->incremental)
+        SVN_ERR (print_header_xml (pool));
+
+    }
+  else
+    {
+      if (opt_state->incremental)
+        return svn_error_create (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("'incremental' option only valid in XML "
+                                   "mode"));
+    }
+
   for (i = 0; i < targets->nelts; i++)
     {
       const char *target = ((const char **) (targets->elts))[i];
@@ -119,17 +167,35 @@
       sb.show_last_committed = opt_state->verbose;
       sb.skip_unrecognized = opt_state->quiet;
       sb.repos_locks = opt_state->update;
+      sb.xml_mode = opt_state->xml;
       sb.pool = subpool;
-      SVN_ERR (svn_client_status2 (NULL, target, &rev, print_status, &sb,
-                                   opt_state->nonrecursive ? FALSE : TRUE,
-                                   opt_state->verbose,
-                                   opt_state->update,
-                                   opt_state->no_ignore,
-                                   opt_state->ignore_externals,
-                                   ctx, subpool));
+
+      if (opt_state->xml)
+        SVN_ERR (svn_client_status3 (NULL, target, &rev, print_status, &sb,
+                                     opt_state->nonrecursive ? FALSE : TRUE,
+                                     opt_state->verbose,
+                                     opt_state->update,
+                                     opt_state->no_ignore,
+                                     opt_state->ignore_externals,
+                                     opt_state->xml,
+                                     ctx, subpool));
+      else
+        SVN_ERR (svn_client_status2 (NULL, target, &rev, print_status, &sb,
+                                     opt_state->nonrecursive ? FALSE : TRUE,
+                                     opt_state->verbose,
+                                     opt_state->update,
+                                     opt_state->no_ignore,
+                                     opt_state->ignore_externals,
+                                     ctx, subpool));
     }
 
   svn_pool_destroy (subpool);
-  
+
+  if (opt_state->xml)
+    {
+      if (! opt_state->incremental)
+        SVN_ERR (print_footer_xml (pool));
+    }
+
   return SVN_NO_ERROR;
 }
Index: subversion/clients/cmdline/dtd/status.dtd
===================================================================
--- subversion/clients/cmdline/dtd/status.dtd	(revision 0)
+++ subversion/clients/cmdline/dtd/status.dtd	(revision 0)
@@ -0,0 +1,19 @@
+<!-- XML DTD for Subversion command-line client output. -->
+
+<!-- For "svn status" -->
+<!ELEMENT status (entry*, status-against?)>
+  <!ELEMENT entry (item-status, prop-status, locked, scheduled, switched, repos-lock, out-of-date?, revision?, rev-last-commit?, author-last-commit?)>
+    <!ATTLIST entry file CDATA #REQUIRED>  <!-- file: character -->
+    <!ELEMENT item-status (#PCDATA)>  <!-- one character status of file or dir -->
+    <!ELEMENT prop-status (#PCDATA)>  <!-- one character status of file or dir property -->
+    <!ELEMENT locked (#PCDATA)>  <!-- one character item locked -->
+    <!ELEMENT scheduled (#PCDATA)>  <!-- one character scheduled for commit -->
+    <!ELEMENT switched (#PCDATA)>  <!-- one character switched from the original path -->
+    <!ELEMENT repos-lock (#PCDATA)>  <!-- one character repository lock tocken -->
+    <!ELEMENT out-of-date (#PCDATA)>  <!-- one character out-of-date -->
+    <!ELEMENT revision (#PCDATA)>  <!-- working revision -->
+    <!ELEMENT rev-last-commit (#PCDATA)>  <!-- last committed revision -->
+    <!ELEMENT author-last-commit (#PCDATA)>  <!-- last committed author -->
+
+  <!ELEMENT status-against EMPTY>
+    <!ATTLIST status-against rev CDATA #IMPLIED>  <!-- status runned against revision -->
Index: subversion/tests/clients/cmdline/stat_tests.py
===================================================================
--- subversion/tests/clients/cmdline/stat_tests.py	(revision 13821)
+++ subversion/tests/clients/cmdline/stat_tests.py	(working copy)
@@ -817,6 +817,72 @@
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 
+def status_in_xml(sbox):
+  "status output in XML format"
+
+  output, error = svntest.actions.run_and_verify_svn (None, None, [],
+                                                      'help', 'status')
+
+  # Checks for --xml option in status help
+  output_omsg = "--xml"
+  output_dmsg = ": output in XML"
+
+  for line in output:
+    if line.find (output_omsg) > 0 and \
+      line.find (output_dmsg) > 0:
+        break
+  else:
+    print "'--xml' option not found in: [svn help status]"
+    raise svntest.Failure
+
+  # Checks for --incremental option in status help
+  output_omsg = "--incremental"
+  output_dmsg = ": give output suitable for concatenation"
+
+  for line in output:
+    if line.find (output_omsg) > 0 and \
+       line.find (output_dmsg) > 0:
+      break
+  else:
+    print "'--incremental' option not found in: [svn help status]"
+    raise svntest.Failure
+
+  # Checks wheather output of the cmd 'status --xml' is in XML format
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  file_name = "iota"
+  file_path = os.path.join (wc_dir, file_name)
+  svntest.main.file_append(file_path, "This line added in iota to test svn st --xml\n")
+
+  template = ["<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
+              "<status>\n",
+              "<entry\n",
+              "   file=\"%s\">\n" % (file_path),
+              "<item-status>M</item-status>\n",
+              "<prop-status> </prop-status>\n",
+              "<locked> </locked>\n",
+              "<scheduled> </scheduled>\n",
+              "<switched> </switched>\n",
+              "<repos-lock> </repos-lock>\n",
+              "<out-of-date> </out-of-date>\n",
+              "<revision>1</revision>\n",
+              "<rev-last-commit>1</rev-last-commit>\n",
+              "<author-last-commit>jrandom</author-last-commit>\n",
+              "</entry>\n",
+              "</status>\n",
+             ]
+
+
+  output, error = svntest.actions.run_and_verify_svn (None, None, [],
+                                                      'status', file_path, '--xml')
+
+  for i in range(0, len(output)):
+    print "Output [%s]\nTemplate [%s]" % (output[i], template[i])
+    if output[i] != template[i]:
+      raise svntest.Failure
+
 #----------------------------------------------------------------------  
 
 
@@ -842,6 +908,7 @@
               status_on_unversioned_dotdot,
               status_on_partially_nonrecursive_wc,
               missing_dir_in_anchor,
+              status_in_xml,
              ]
 
 if __name__ == '__main__':
