diff --git a/darcs-beta.cabal b/darcs-beta.cabal
--- a/darcs-beta.cabal
+++ b/darcs-beta.cabal
@@ -1,5 +1,5 @@
 Name: darcs-beta
-version:        2.4.98.3
+version:        2.4.98.4
 License:        GPL
 License-file:   COPYING
 Author:         David Roundy <droundy@darcs.net>, <darcs-users@darcs.net>
diff --git a/release/distributed-context b/release/distributed-context
--- a/release/distributed-context
+++ b/release/distributed-context
@@ -1,1 +1,1 @@
-Just "\nContext:\n\n[TAG 2.4.98.3\nReinier Lamers <tux_rocker@reinier.de>**20100815194519\n Ignore-this: e3a3c30d7dd2fbe49c846c48510a9c3c\n] \n"
+Just "\nContext:\n\n[TAG 2.4.98.4\nReinier Lamers <tux_rocker@reinier.de>**20100823183505\n Ignore-this: 8257375d159e0d5a8cb548c6374adf39\n] \n"
diff --git a/src/Darcs/Arguments.lhs b/src/Darcs/Arguments.lhs
--- a/src/Darcs/Arguments.lhs
+++ b/src/Darcs/Arguments.lhs
@@ -25,7 +25,7 @@
                          maxCount,
                          isin, arein,
                          definePatches, defineChanges,
-                         fixFilePathOrStd, fixUrl,
+                         fixFilePathOrStd, fixUrl, fixUrlFlag,
                          fixSubPaths, areFileArgs,
                          DarcsAtomicOption( .. ), atomicOptions,
                          DarcsOption( .. ), optionFromDarcsOption,
@@ -472,6 +472,10 @@
     case extractFixPath opts of
       Nothing -> bug "Can't fix path in fixFilePathOrStd"
       Just (_,o) -> withCurrentDirectory o $ ioAbsoluteOrStd f
+
+fixUrlFlag :: [DarcsFlag] -> DarcsFlag -> IO DarcsFlag
+fixUrlFlag opts (RemoteRepo f) = RemoteRepo `fmap` fixUrl opts f
+fixUrlFlag _ f = return f
 
 fixUrl :: [DarcsFlag] -> String -> IO String
 fixUrl opts f = if isFile f
diff --git a/src/Darcs/Diff.hs b/src/Darcs/Diff.hs
--- a/src/Darcs/Diff.hs
+++ b/src/Darcs/Diff.hs
@@ -34,30 +34,53 @@
 import qualified Data.ByteString.Lazy.Char8 as BLC
 import qualified Data.ByteString as BS
 import qualified Data.ByteString.Lazy as BL
+import Data.List ( sortBy )
 import ByteStringUtils( isFunky )
 
 #include "gadts.h"
+#include "impossible.h"
 
-treeDiff :: Gap w => (FilePath -> FileType) -> Tree IO -> Tree IO -> IO (w (FL Prim))
+data Diff m = Added (TreeItem m) | Removed (TreeItem m) | Changed (TreeItem m) (TreeItem m)
+
+getDiff :: AnchoredPath -> Maybe (TreeItem m) -> Maybe (TreeItem m) -> (AnchoredPath, Diff m)
+getDiff p Nothing (Just t) = (p, Added t)
+getDiff p (Just from) (Just to) = (p, Changed from to)
+getDiff p (Just t) Nothing = (p, Removed t)
+getDiff p Nothing Nothing = impossible -- zipTrees should never return this
+
+treeDiff :: forall m w . (Functor m, Monad m, Gap w) => (FilePath -> FileType) -> Tree m -> Tree m -> m (w (FL Prim))
 treeDiff ft t1 t2 = do
   (from, to) <- diffTrees t1 t2
-  diffs <- sequence $ zipTrees diff from to
+  diffs <- mapM (uncurry diff) $ sortBy organise $ zipTrees getDiff from to
   return $ foldr (joinGap (+>+)) (emptyGap NilFL) diffs
-    where diff :: Gap w
-               => AnchoredPath -> Maybe (TreeItem IO) -> Maybe (TreeItem IO)
-               -> IO (w (FL Prim))
-          diff _ (Just (SubTree _)) (Just (SubTree _)) = return (emptyGap NilFL)
-          diff p (Just (SubTree _)) Nothing =
+    where
+          -- sort into removes, changes, adds, with removes in reverse-path order
+          -- and everything else in forward order
+          organise :: (AnchoredPath, Diff m) -> (AnchoredPath, Diff m) -> Ordering
+
+          organise (p1, Changed _ _ ) (p2, Changed _ _) = compare p1 p2
+          organise (p1, Added _)      (p2, Added _)   = compare p1 p2
+          organise (p1, Removed _)    (p2, Removed _) = compare p2 p1
+
+          organise (p1, Removed _) _ = LT
+          organise _ (p1, Removed _) = GT
+
+          organise (p1, Changed _ _) _ = LT
+          organise _ (p1, Changed _ _) = GT
+
+          diff :: AnchoredPath -> Diff m -> m (w (FL Prim))
+          diff _ (Changed (SubTree _) (SubTree _)) = return (emptyGap NilFL)
+          diff p (Removed (SubTree _)) =
               return $ freeGap (rmdir (anchorPath "" p) :>: NilFL)
-          diff p Nothing (Just (SubTree _)) =
+          diff p (Added (SubTree _)) =
               return $ freeGap (adddir (anchorPath "" p) :>: NilFL)
-          diff p Nothing b'@(Just (File _)) =
-              do diff' <- diff p (Just (File emptyBlob)) b'
+          diff p (Added b'@(File _)) =
+              do diff' <- diff p (Changed (File emptyBlob) b')
                  return $ joinGap (:>:) (freeGap (addfile (anchorPath "" p))) diff'
-          diff p a'@(Just (File _)) Nothing =
-              do diff' <- diff p a' (Just (File emptyBlob))
+          diff p (Removed a'@(File _)) =
+              do diff' <- diff p (Changed a' (File emptyBlob))
                  return $ joinGap (+>+) diff' (freeGap (rmfile (anchorPath "" p) :>: NilFL))
-          diff p (Just (File a')) (Just (File b')) =
+          diff p (Changed (File a') (File b')) =
               do a <- readBlob a'
                  b <- readBlob b'
                  let path = anchorPath "" p
@@ -67,7 +90,7 @@
                    _ -> return $ if a /= b
                                     then freeGap (binary path (strict a) (strict b) :>: NilFL)
                                     else emptyGap NilFL
-          diff p _ _ = fail $ "Missing case at path " ++ show p
+          diff p _ = fail $ "Missing case at path " ++ show p
           text_diff p a b
               | BL.null a && BL.null b = emptyGap NilFL
               | BL.null a = freeGap (diff_from_empty p b)
diff --git a/src/Darcs/Repository/Prefs.lhs b/src/Darcs/Repository/Prefs.lhs
--- a/src/Darcs/Repository/Prefs.lhs
+++ b/src/Darcs/Repository/Prefs.lhs
@@ -447,17 +447,26 @@
 defaultrepo _ _ r = return r
 
 setDefaultrepo :: String -> [DarcsFlag] -> IO ()
-setDefaultrepo r opts =  do doit <- if (NoSetDefault `notElem` opts && DryRun `notElem` opts && r_is_not_tmp)
-                                    then return True
-                                    else do olddef <-
-                                                getPreflist "defaultrepo"
-                                            return (olddef == [])
-                            when doit
-                                (setPreflist "defaultrepo" [r])
+setDefaultrepo r opts =  do olddef <- getPreflist "defaultrepo"
+                            let doit = NoSetDefault `notElem` opts && greenLight
+                                greenLight = wetRun
+                                           && not rIsTmp
+                                           && (olddef /= [r] || olddef == [])
+                            if doit
+                               then setPreflist "defaultrepo" [r]
+                               else when greenLight $ putStr . unlines $
+                                      -- the nuance here is that we should only notify when the
+                                      -- reason we're not setting default is the --no-set-default
+                                      -- flag, not the various automatic show stoppers
+                                      [ "Note: if you want to change the default remote repository to"
+                                      , r ++ ","
+                                      , "quit now and issue the same command with the --set-default flag."
+                                      ]
                             addToPreflist "repos" r
                          `catchall` return () -- we don't care if this fails!
  where
-  r_is_not_tmp = not $ r `elem` [x | RemoteRepo x <- opts]
+  wetRun = DryRun `notElem` opts
+  rIsTmp = r `elem` [x | RemoteRepo x <- opts]
 \end{code}
 
 \paragraph{email}
diff --git a/src/Darcs/RunCommand.hs b/src/Darcs/RunCommand.hs
--- a/src/Darcs/RunCommand.hs
+++ b/src/Darcs/RunCommand.hs
@@ -26,6 +26,7 @@
 
 import Darcs.Arguments ( DarcsFlag(..),
                          help,
+                         fixUrlFlag,
                          optionFromDarcsOption,
                          listOptions, nubOptions )
 import Darcs.ArgumentDefaults ( getDefaultFlags )
@@ -140,7 +141,8 @@
                if preHookExitCode /= ExitSuccess
                   then exitWith preHookExitCode
                   else do let fixFlag = FixFilePath here cwd
-                          (commandCommand cmd) (fixFlag : os) ex
+                          fixedOs <- mapM (fixUrlFlag [fixFlag]) os
+                          (commandCommand cmd) (fixFlag : fixedOs) ex
                           postHookExitCode <- runPosthook os here
                           exitWith postHookExitCode
 
diff --git a/tests/issue1875-honor-no-set-default.sh b/tests/issue1875-honor-no-set-default.sh
new file mode 100644
--- /dev/null
+++ b/tests/issue1875-honor-no-set-default.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+## Test for issue1875 - corner cases in which darcs may accidentally
+## set default even though it's not supposed to
+##
+## Copyright (C) 2010 Eric Kow
+##
+## Permission is hereby granted, free of charge, to any person
+## obtaining a copy of this software and associated documentation
+## files (the "Software"), to deal in the Software without
+## restriction, including without limitation the rights to use, copy,
+## modify, merge, publish, distribute, sublicense, and/or sell copies
+## of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be
+## included in all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+## SOFTWARE.
+
+. lib                           # Load some portability helpers.
+rm -rf R S                      # Another script may have left a mess.
+darcs init      --repo R        # Create our test repos.
+darcs get R S  --no-set-default
+not find S/_darcs/prefs/defaultrepo
+rm -rf S
+
+darcs init --repo S
+cd S
+darcs push ../R --dry-run
+not grep '/R$' _darcs/prefs/defaultrepo
+darcs push ../R
+cd ..
diff --git a/tests/issue1898-set-default-notification.sh b/tests/issue1898-set-default-notification.sh
new file mode 100644
--- /dev/null
+++ b/tests/issue1898-set-default-notification.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+## Test for issue1898 - set-default mechanism
+##
+## Copyright (C) 2010 Eric Kow
+##
+## Permission is hereby granted, free of charge, to any person
+## obtaining a copy of this software and associated documentation
+## files (the "Software"), to deal in the Software without
+## restriction, including without limitation the rights to use, copy,
+## modify, merge, publish, distribute, sublicense, and/or sell copies
+## of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be
+## included in all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+## SOFTWARE.
+
+. lib                           # Load some portability helpers.
+rm -rf R0 R1 R2 S               # Another script may have left a mess.
+darcs init      --repo R0       # Create our test repos.
+
+darcs get R0 R1
+darcs get R0 R2
+darcs get R0 S
+
+cd S
+# default to no-set-default
+darcs push ../R1 > log
+grep '/R0$' _darcs/prefs/defaultrepo
+# notification when using no-set-default
+grep "set-default" log
+# set-default works
+darcs push ../R1 --set-default > log
+grep '/R1$' _darcs/prefs/defaultrepo
+# no notification when already using --set-default
+not grep "set-default" log
+# no notification when already pushing to the default repo
+darcs push > log
+not grep "set-default" log
+# no notification when it's just the --remote-repo
+darcs push --remote-repo ../R1 > log
+not grep "set-default" log
+# but... notification still works in presence of remote-repo
+darcs push --remote-repo ../R1 ../R2 > log
+grep "set-default" log
+cd ..
diff --git a/tests/issue1913-diffing.sh b/tests/issue1913-diffing.sh
new file mode 100644
--- /dev/null
+++ b/tests/issue1913-diffing.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+## Test for issue1913 - test for directory diffing
+##
+## Copyright (C) 2010 Ian Lynagh
+##
+## Permission is hereby granted, free of charge, to any person
+## obtaining a copy of this software and associated documentation
+## files (the "Software"), to deal in the Software without
+## restriction, including without limitation the rights to use, copy,
+## modify, merge, publish, distribute, sublicense, and/or sell copies
+## of the Software, and to permit persons to whom the Software is
+## furnished to do so, subject to the following conditions:
+##
+## The above copyright notice and this permission notice shall be
+## included in all copies or substantial portions of the Software.
+##
+## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+## SOFTWARE.
+
+. lib                           # Load some portability helpers.
+rm -rf R                        # Another script may have left a mess.
+darcs init      --repo R        # Create our test repos.
+
+cd R
+mkdir foo
+touch foo/foofile
+darcs rec -l -a -m "foo patch"
+mkdir bar
+touch bar/barfile
+rm -r foo
+darcs rec -l -a -m "bar patch"
+not darcs whatsnew -l
+cd ..
diff --git a/tests/output.sh b/tests/output.sh
--- a/tests/output.sh
+++ b/tests/output.sh
@@ -30,7 +30,7 @@
 diff -u ../patchfile ../correct
 
 rm ../patchfile
-darcs send -a --dont-edit-description -o - ../../temp2 > ../patchfile
+darcs send -a --set-default --dont-edit-description -o - ../../temp2 > ../patchfile
 grep -v Creating ../patchfile | diff -u ../correct -
 
 darcs apply --repodir=../../temp2 --dry-run ../patchfile > out
diff --git a/tests/pull.sh b/tests/pull.sh
--- a/tests/pull.sh
+++ b/tests/pull.sh
@@ -25,7 +25,7 @@
 darcs add one;
 darcs record --patch-name uno --all
 cd ..     # now outside of any repo
-darcs pull --repodir temp1 --all temp2 | grep -i 'Finished pulling.' # temp2 is not relative to temp1
+darcs pull --set-default --repodir temp1 --all temp2 | grep -i 'Finished pulling.' # temp2 is not relative to temp1
 
 # set up server repo
 date > temp2/one/date.t
@@ -119,7 +119,7 @@
 darcs record -am newdir
 cd ../temp2
 mkdir newdir
-darcs pull -a ../temp1 &> out2
+darcs pull -a --set-default ../temp1 &> out2
 cat out
 grep Backing out2
 grep 'Finished pulling' out2
diff --git a/tests/pull_binary.sh b/tests/pull_binary.sh
--- a/tests/pull_binary.sh
+++ b/tests/pull_binary.sh
@@ -19,7 +19,7 @@
 mkdir temp2
 cd temp2
 darcs init
-echo yn | darcs pull ../temp1
+echo yn | darcs pull --set-default ../temp1
 rm foo
 darcs pull -a
 cd ..
diff --git a/tests/utf8.sh b/tests/utf8.sh
--- a/tests/utf8.sh
+++ b/tests/utf8.sh
@@ -166,7 +166,7 @@
 # and that it doesn't get mangled on push
 rm -rf temp2
 mkdir temp2; darcs init --repodir temp2
-darcs push --repodir temp1 -a temp2
+darcs push --repodir temp1 -a temp2 --set-default
 darcs changes --repodir temp1 --xml > temp1/changes.xml
 darcs changes --repodir temp2 --xml > temp2/changes.xml
 diff temp1/changes.xml temp2/changes.xml
