Index: ./subversion/svnadmin/main.c
===================================================================
--- ./subversion/svnadmin/main.c
+++ ./subversion/svnadmin/main.c	Tue Feb 26 09:27:23 2002
@@ -275,7 +275,7 @@
       {
         svn_revnum_t youngest_rev;
         svn_fs_root_t *rev_root;
-        apr_array_header_t *revs;
+        apr_array_header_t *revs, *paths;
         int i;
 
         if (argc != 4)
@@ -284,14 +284,17 @@
             /* NOTREACHED */
           }
 
+	paths = apr_array_make (pool, 1, sizeof (svn_stringbuf_t *));
+	(*(svn_stringbuf_t **)apr_array_push(paths)) = svn_stringbuf_create(argv[3], pool);
+
         INT_ERR (svn_repos_open (&repos, path, pool));
         fs = svn_repos_fs (repos);
         svn_fs_youngest_rev (&youngest_rev, fs, pool);
         INT_ERR (svn_fs_revision_root (&rev_root, fs, youngest_rev, pool));
-        INT_ERR (svn_fs_revisions_changed (&revs, rev_root, argv[3], pool));
+        INT_ERR (svn_fs_revisions_changed (&revs, rev_root, paths, pool));
         for (i = 0; i < revs->nelts; i++)
           {
             svn_revnum_t this_rev = ((svn_revnum_t *)revs->elts)[i];
             printf ("%ld\n", (long int)this_rev);
           }
       }
Index: ./subversion/include/svn_fs.h
===================================================================
--- ./subversion/include/svn_fs.h
+++ ./subversion/include/svn_fs.h	Wed Feb 27 22:05:44 2002
@@ -666,7 +666,10 @@
 
 
 /* Allocate and return an array *REVS of svn_revnum_t revisions in
-   which PATH under ROOT was modified.  Use POOL for all allocations.
+   which PATHS under ROOT were modified.  Use POOL for all allocations.
+   The array of *REVS are sorted in descending order. This function does
+   not guarantee the lack of duplicates (where more than one path was
+   modified in the same revision), so you'll have to handle that.
 
    NOTE: This function uses node-id ancestry alone to determine
    modifiedness, and therefore does NOT claim that in any of the
@@ -674,7 +677,7 @@
    directory entries lists changed, etc.  */
 svn_error_t *svn_fs_revisions_changed (apr_array_header_t **revs,
                                        svn_fs_root_t *root,
-                                       const char *path,
+                                       const apr_array_header_t *paths,
                                        apr_pool_t *pool);
 
 
Index: ./subversion/include/svn_sorts.h
===================================================================
--- ./subversion/include/svn_sorts.h
+++ ./subversion/include/svn_sorts.h	Tue Feb 26 10:21:14 2002
@@ -70,6 +70,18 @@
 int svn_sort_compare_items_as_paths (const svn_item_t *a, const svn_item_t *b);
 
 
+/* Compare two svn_revnum_t's, returning an integer greater than, equal
+ * to, or less than 0, according as B is greater than, equal to, or less
+ * than A. Note that this sorts newest revsion to oldest (IOW, descending
+ * order).
+ *
+ * This is useful for converting an array of revisions into a sorted
+ * apr_array_header_t. You are responsible for detecting, preventing or
+ * removing duplicates.
+ */
+int svn_sort_compare_revisions (const void *a, const void *b);
+
+
 #ifndef apr_hash_sorted_keys
 /* Sort HT according to its keys, return an apr_array_header_t
    containing svn_item_t structures holding those keys and values
Index: ./subversion/libsvn_fs/tree.c
===================================================================
--- ./subversion/libsvn_fs/tree.c
+++ ./subversion/libsvn_fs/tree.c	Wed Feb 27 22:05:48 2002
@@ -36,6 +36,8 @@
 #include "svn_pools.h"
 #include "svn_error.h"
 #include "svn_fs.h"
+#include "svn_hash.h"
+#include "svn_sorts.h"
 #include "skel.h"
 #include "id.h"
 #include "fs.h"
@@ -2752,7 +2754,7 @@
 {
   apr_array_header_t **revs;
   svn_fs_t *fs;
-  svn_fs_id_t *id;
+  apr_array_header_t *ids;
   apr_pool_t *pool;
 };
 
@@ -2764,34 +2766,40 @@
   dag_node_t *node;
   svn_fs_id_t *tmp_id;
   svn_revnum_t revision;
+  int i, len;
 
   /* Allocate an array for holding revision numbers. */
   array = apr_array_make (args->pool, 4, sizeof (svn_revnum_t));
 
   /* Loop, from ID, through its predecessors, until it ceases to
      exist. */
-  tmp_id = svn_fs_copy_id (args->id, args->pool);
-  do
-    {
-      int len = svn_fs_id_length (tmp_id);
-
-      /* Get the dag node for this id. */
-      SVN_ERR (svn_fs__dag_get_node (&node, args->fs, tmp_id, trail));
 
-      /* Now get the revision from the dag. */
-      SVN_ERR (svn_fs__dag_get_revision (&revision, node, trail));
-
-      /* And put the revision into our array. */
-      (*((svn_revnum_t *) apr_array_push (array))) = revision;
-
-      /* Hack up TMP_ID so that it represents its own predecessor. */
-      tmp_id[len - 1]--;
-      if (tmp_id[len - 1] == 0)
-        tmp_id[len - 2] = -1;
-    }
-  while (tmp_id[0] != -1);
-
-  /* Now make the array "go live". */
+  for (i = 0; i < args->ids->nelts; i++)
+    {
+      tmp_id = svn_fs_copy_id ((((svn_fs_id_t **)args->ids->elts)[i]), args->pool);
+      len = svn_fs_id_length (tmp_id);
+      do
+	{
+	  /* Get the dag node for this id. */
+	  SVN_ERR (svn_fs__dag_get_node (&node, args->fs, tmp_id, trail));
+
+	  /* Now get the revision from the dag. */
+	  SVN_ERR (svn_fs__dag_get_revision (&revision, node, trail));
+
+	  /* And put the revision into our array. */
+	  (*((svn_revnum_t *) apr_array_push (array))) = revision;
+
+	  /* Hack up TMP_ID so that it represents its own predecessor. */
+	  tmp_id[len - 1]--;
+	  if (tmp_id[len - 1] == 0)
+	    tmp_id[len - 2] = -1;
+	}
+      while (tmp_id[0] != -1);
+    }
+
+  /* Now sort the array and make it "go live". */
+  qsort(array->elts, array->nelts, array->elt_size,
+	svn_sort_compare_revisions);
   *(args->revs) = array;
 
   return SVN_NO_ERROR;
@@ -2800,19 +2808,28 @@
 svn_error_t *
 svn_fs_revisions_changed (apr_array_header_t **revs,
                           svn_fs_root_t *root,
-                          const char *path,
+                          const apr_array_header_t *paths,
                           apr_pool_t *pool)
 {
   struct revisions_changed_args args;
   svn_fs_t *fs = svn_fs_root_fs (root);
+  int i;
+  svn_fs_id_t *tmp_id;
+  svn_stringbuf_t *this_path;
 
   /* Populate the baton. */
   args.revs = revs;
   args.fs = fs;
   args.pool = pool;
+  args.ids = apr_array_make (pool, 1, sizeof (svn_fs_id_t *));
 
   /* Get the node-id for PATH under ROOT. */
-  SVN_ERR (svn_fs_node_id (&(args.id), root, path, pool));
+  for (i = 0; i < paths->nelts; i++)
+    {
+      this_path = (((svn_stringbuf_t **)(paths)->elts)[i]);
+      SVN_ERR (svn_fs_node_id (&tmp_id, root, this_path->data, pool));
+      *((svn_fs_id_t **) apr_array_push (args.ids)) = tmp_id;
+    }
 
   /* Call the real function under the umbrella of a trail. */
   SVN_ERR (svn_fs__retry_txn (fs, txn_body_revisions_changed, &args, pool));
Index: ./subversion/libsvn_subr/sorts.c
===================================================================
--- ./subversion/libsvn_subr/sorts.c
+++ ./subversion/libsvn_subr/sorts.c	Tue Feb 26 09:03:22 2002
@@ -83,6 +83,18 @@
   return svn_path_compare_paths (str_a, str_b);
 }
 
+int
+svn_sort_compare_revisions (const void *a, const void *b)
+{
+  svn_revnum_t a_rev = *(svn_revnum_t *)a;
+  svn_revnum_t b_rev = *(svn_revnum_t *)b;
+
+  if (a_rev == b_rev)
+    return 0;
+
+  return a_rev < b_rev ? 1 : -1;
+}
+
 
 #ifndef apr_hash_sort_keys
 
Index: ./subversion/libsvn_client/log.c
===================================================================
--- ./subversion/libsvn_client/log.c
+++ ./subversion/libsvn_client/log.c	Tue Feb 26 16:08:10 2002
@@ -58,8 +58,8 @@
   svn_ra_plugin_t *ra_lib;  
   void *ra_baton, *session;
   svn_stringbuf_t *URL;
-  svn_wc_entry_t *entry;
-  svn_stringbuf_t *basename;
+  svn_stringbuf_t *basename = NULL;
+  svn_string_t path_str;
   apr_array_header_t *condensed_targets;
   svn_revnum_t start_revnum, end_revnum;
 
@@ -71,20 +71,68 @@
          "svn_client_log: caller failed to supply revision");
     }
 
-  SVN_ERR (svn_path_condense_targets (&basename, &condensed_targets,
-                                      targets, pool));
+  start_revnum = end_revnum = SVN_INVALID_REVNUM;
 
-  /* Get full URL from the common path, carefully. */
-  SVN_ERR (svn_wc_entry (&entry, basename, pool));
-  if (! entry)
-    return svn_error_createf
-      (SVN_ERR_UNVERSIONED_RESOURCE, 0, NULL, pool,
-       "svn_client_log: %s is not under revision control", basename->data);
-  if (! entry->url)
-    return svn_error_createf
-      (SVN_ERR_ENTRY_MISSING_URL, 0, NULL, pool,
-       "svn_client_log: entry '%s' has no URL", basename->data);
-  URL = svn_stringbuf_dup (entry->url, pool);
+  path_str.data = ((svn_stringbuf_t **)targets->elts)[0]->data;
+  path_str.len = ((svn_stringbuf_t **)targets->elts)[0]->len;
+
+  /* Use the passed URL, if there is one.  */
+  if (svn_path_is_url (&path_str))
+    {
+      svn_stringbuf_t *base, *file;
+      
+      /* The logic here is this: If we get passed one argument, we assume
+       * it is the full URL to a file/dir we want log info for. If we get
+       * a URL plus some paths, then we assume that the URL is the base,
+       * and that the paths passed are relative to it.  */
+      base = ((svn_stringbuf_t **) (targets->elts))[0];
+      svn_path_split (base, &basename, &file, pool);
+      URL = svn_path_uri_encode(&path_str, pool);
+      condensed_targets = apr_array_make (pool, 1, sizeof(svn_stringbuf_t *));
+
+      if (targets->nelts > 1)
+        {
+	  int i;
+
+	  /* We have some paths, let's use them. Start after the URL.  */
+	  for (i = 1; i < targets->nelts; i++)
+	    (*((svn_stringbuf_t**)apr_array_push (condensed_targets))) =
+		(((svn_stringbuf_t **) (targets->elts))[i]);
+	}
+      else
+        {
+	  /* Ok, our URL better contain all the info we need then. IOW, it
+	   * will be in the form of scheme://URLPATH/file-or-dir.  */
+	  (*((svn_stringbuf_t**)apr_array_push (condensed_targets))) = file;
+
+	  /* Chop off one component from the URL.  */
+	  svn_path_remove_component(base);
+	  path_str.data = base->data;
+	  path_str.len = base->len;
+	}
+      /* Now set the URL.  */
+      URL = svn_path_uri_encode(&path_str, pool);
+    }
+  else
+    {
+      svn_wc_entry_t *entry;
+
+      /* Use local working copy.  */
+
+      SVN_ERR (svn_path_condense_targets (&basename, &condensed_targets,
+					  targets, pool));
+
+      SVN_ERR (svn_wc_entry (&entry, basename, pool));
+      if (! entry)
+	return svn_error_createf
+	  (SVN_ERR_UNVERSIONED_RESOURCE, 0, NULL, pool,
+	  "svn_client_log: %s is not under revision control", basename->data);
+      if (! entry->url)
+	return svn_error_createf
+	  (SVN_ERR_ENTRY_MISSING_URL, 0, NULL, pool,
+	  "svn_client_log: entry '%s' has no URL", basename->data);
+      URL = svn_stringbuf_dup (entry->url, pool);
+    }
 
   /* Get the RA library that handles URL. */
   SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
@@ -94,13 +142,14 @@
   SVN_ERR (svn_client__open_ra_session (&session, ra_lib, URL, basename,
                                         TRUE, TRUE, auth_baton, pool));
 
+  /* Get the revisions based on the users "hints".  */
   SVN_ERR (svn_client__get_revision_number
            (&start_revnum, ra_lib, session, start, basename->data, pool));
   SVN_ERR (svn_client__get_revision_number
            (&end_revnum, ra_lib, session, end, basename->data, pool));
 
   SVN_ERR (ra_lib->get_log (session,
-                            condensed_targets,  /* ### todo: or `targets'? */
+                            condensed_targets,
                             start_revnum,
                             end_revnum,
                             discover_changed_paths,
Index: ./subversion/clients/cmdline/man/svn.1
===================================================================
--- ./subversion/clients/cmdline/man/svn.1
+++ ./subversion/clients/cmdline/man/svn.1	Thu Feb 28 16:25:28 2002
@@ -215,11 +220,38 @@
 \fBimport\fP \fIRepository-URL\fP [\fIPath\fP] [\fINew-Repository-Entry\fP]
 Import a file or tree into the repository.
 .TP
-\fBlog\fP [\fIfile|dir\fP]
+\fBlog\fP [\fIurl\fP] [\fIfile|dir\fP]
 Show log messages (and affected entities) for commits in which any of the
 entities in question changed.  If none were specified, then recursive
-inclusion is the default.  The set of messages can be further restricted by a
-date or revision range specification (using -d or -r).
+inclusion is the default.  The set of messages can be further restricted
+by a date or revision range specification (using -d or -r). A URL can also
+be specific to retrieve logs from a remote repository. If the URL is
+passed alone, then only that entry will be searched. If paths are also
+supplied with the URL, then only those paths are searched, based at the
+given URL.
+
+\fBexample:\fP svn log
+
+Recursively retrieve logs for all revision under "."
+
+\fBexample:\fP svn log README
+
+Retrieve logs for only those revisions where README was affected.
+
+\fBexample:\fP svn log http://rep.com/repo/README
+
+Retrieve logs for the file without the need for a local checkout of the
+repository.
+
+\fBexample:\fP svn log README LICENSE
+
+Retrive logs for all revisions where both files were affected.
+
+\fBexample:\fP svn log http://rep.com/repo README LICENSE
+
+Retrieve logs for both files in the remote repository without the need for
+a local checkout of the repository.
+
 .TP
 \fBmkdir\fP [\fIdirectory...\fP]
 Create the directory(ies), if they do not already exist. The directories can
Index: ./subversion/clients/cmdline/main.c
===================================================================
--- ./subversion/clients/cmdline/main.c
+++ ./subversion/clients/cmdline/main.c	Thu Feb 28 15:09:51 2002
@@ -189,8 +190,20 @@
   
   { "log", svn_cl__log, {0},
     "Show the log messages for a set of revision(s) and/or file(s).\n"
-    "usage: svn log [PATH1 [PATH2] ...] \n",
-    {'r', 'v', svn_cl__auth_username_opt, svn_cl__auth_password_opt} },
+    "usage: svn log [URL] [PATH1 [PATH2] ...] \n"
+    "    Either get the log messages for local PATHs or PATHs at the\n"
+    "    URL. If URL is given by itself, then log messages are output for\n"
+    "    that specific path. The -v option will include a list of affected\n"
+    "    files for each log message. Examples are:\n"
+    "\n"
+    "    svn log\n"
+    "\n"
+    "    svn log foo.c\n"
+    "\n"
+    "    svn log http://www.example.com/repo/project/foo.c\n"
+    "\n"
+    "    svn log http://www.example.com/repo/project foo.c bar.c\n",
+    {'r', 'D', 'v', svn_cl__auth_username_opt, svn_cl__auth_password_opt} },
   
   { "merge", svn_cl__merge, {0},
     "Merge changes in the working copy.  IMPLEMENTATION INCOMPLETE.\n"
Index: ./subversion/tests/libsvn_fs/fs-test.c
===================================================================
--- ./subversion/tests/libsvn_fs/fs-test.c
+++ ./subversion/tests/libsvn_fs/fs-test.c	Tue Feb 26 16:08:58 2002
@@ -5754,8 +5754,12 @@
         int i;
         const char *path = greek_paths[j];
         const svn_revnum_t num_revs = chrevs[j][0];
+	apr_array_header_t *paths;
+
+	paths = apr_array_make (spool, 1, sizeof (svn_stringbuf_t *));
+	(*(svn_stringbuf_t **)apr_array_push(paths)) = svn_stringbuf_create(path, pool);
         
-        SVN_ERR (svn_fs_revisions_changed (&revs, rev_root, path, spool));
+        SVN_ERR (svn_fs_revisions_changed (&revs, rev_root, paths, spool));
 
         /* Are we at least looking at the right number of returned
            revisions? */
Index: ./subversion/libsvn_repos/log.c
===================================================================
--- ./subversion/libsvn_repos/log.c
+++ ./subversion/libsvn_repos/log.c	Tue Feb 26 15:09:08 2002
@@ -104,6 +104,8 @@
   apr_pool_t *subpool = svn_pool_create (pool);
   apr_hash_t *changed_paths = NULL;
   svn_fs_t *fs = repos->fs;
+  svn_fs_root_t *root;
+  apr_array_header_t *revs = NULL;
 
   if (start == SVN_INVALID_REVNUM)
     SVN_ERR (svn_fs_youngest_rev (&start, fs, pool));
@@ -111,12 +113,32 @@
   if (end == SVN_INVALID_REVNUM)
     SVN_ERR (svn_fs_youngest_rev (&end, fs, pool));
 
+  if (paths && paths->nelts)
+    {
+      SVN_ERR (svn_fs_revision_root (&root, fs, (start > end) ? start : end, subpool));
+      SVN_ERR (svn_fs_revisions_changed (&revs, root, paths, subpool));
+      if (!revs || !revs->nelts)
+	return SVN_NO_ERROR;
+    }
+
   for (this_rev = start;
        ((start >= end) ? (this_rev >= end) : (this_rev <= end));
        ((start >= end) ? this_rev-- : this_rev++))
     {
       svn_string_t *author, *date, *message;
 
+      /* If we have a list of revs for use, check to make sure this is one
+       * of them.  */
+      if (revs)
+        {
+	  int i, matched = 0;
+	  for (i = 0; i < revs->nelts; i++)
+	    if (this_rev == ((svn_revnum_t *)(revs->elts))[i])
+	      matched = 1;
+	  if (! matched)
+	    continue;
+	}
+
       SVN_ERR (svn_fs_revision_prop
                (&author, fs, this_rev, SVN_PROP_REVISION_AUTHOR, subpool));
       SVN_ERR (svn_fs_revision_prop
@@ -188,32 +210,6 @@
              for repository style. */
         }
 
-      /* Check if any of the filter paths changed in this revision. */
-      if (paths && paths->nelts > 0)
-        {
-          int i;
-          void *val;
-
-          for (i = 0; i < paths->nelts; i++)
-            {
-              svn_stringbuf_t *this_path;
-              this_path = (((svn_stringbuf_t **)(paths)->elts)[i]);
-              val = apr_hash_get (changed_paths,
-                                  this_path->data, this_path->len); 
-              
-              if (val)   /* Stop looking -- we've found a match. */
-                break;
-            }
-
-          /* The check below happens outside the `for' loop
-             immediately above, so that the `continue' will apply to
-             the outermost `for' loop.  The logic is: if we are doing
-             path filtering, and this revision *doesn't* affect one of
-             the filter paths, then we skip the invocation of the log
-             receiver and `continue' on to the next revision. */
-          if (! val)
-            continue;
-        }
 #endif /* SVN_REPOS_ALLOW_LOG_WITH_PATHS */
 
       SVN_ERR ((*receiver) (receiver_baton,


