changeset 2475:7a77934ece46

merge with crew.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 21 Jun 2006 09:32:31 -0700
parents 1e32e2fe8a67 (diff) 6904e1ef8ad1 (current diff)
children 0f7e4a39d9af
files mercurial/hg.py mercurial/localrepo.py
diffstat 4 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2151,7 +2151,6 @@ def pull(ui, repo, source="default", **o
       with the --ssh command line option.
     """
     source = ui.expandpath(source)
-    ui.status(_('pulling from %s\n') % (source))
 
     if opts['ssh']:
         ui.setconfig("ui", "ssh", opts['ssh'])
@@ -2159,6 +2158,7 @@ def pull(ui, repo, source="default", **o
         ui.setconfig("ui", "remotecmd", opts['remotecmd'])
 
     other = hg.repository(ui, source)
+    ui.status(_('pulling from %s\n') % (source))
     revs = None
     if opts['rev'] and not other.local():
         raise util.Abort(_("pull -r doesn't work for remote repositories yet"))
@@ -2190,7 +2190,6 @@ def push(ui, repo, dest="default-push", 
     about ssh:// URLs.
     """
     dest = ui.expandpath(dest)
-    ui.status('pushing to %s\n' % (dest))
 
     if opts['ssh']:
         ui.setconfig("ui", "ssh", opts['ssh'])
@@ -2198,6 +2197,7 @@ def push(ui, repo, dest="default-push", 
         ui.setconfig("ui", "remotecmd", opts['remotecmd'])
 
     other = hg.repository(ui, dest)
+    ui.status('pushing to %s\n' % (dest))
     revs = None
     if opts['rev']:
         revs = [repo.lookup(rev) for rev in opts['rev']]
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -10,6 +10,7 @@ from repo import *
 from demandload import *
 from i18n import gettext as _
 demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo")
+demandload(globals(), "os util")
 
 def bundle(ui, path):
     if path.startswith('bundle://'):
@@ -28,6 +29,8 @@ def hg(ui, path):
     return httprepo.httprepository(ui, path.replace("hg://", "http://"))
 
 def local_(ui, path, create=0):
+    if path.startswith('file:'):
+        path = path[5:]
     return localrepo.localrepository(ui, path, create)
 
 def old_http(ui, path):
@@ -40,7 +43,7 @@ def static_http(ui, path):
     return statichttprepo.statichttprepository(
         ui, path.replace("static-http://", "http://"))
 
-protocols = {
+schemes = {
     'bundle': bundle,
     'file': local_,
     'hg': hg,
@@ -49,7 +52,6 @@ protocols = {
     'old-http': old_http,
     'ssh': lambda ui, path: sshrepo.sshrepository(ui, path),
     'static-http': static_http,
-    None: local_,
     }
 
 def repository(ui, path=None, create=0):
@@ -57,14 +59,11 @@ def repository(ui, path=None, create=0):
     if scheme:
         c = scheme.find(':')
         scheme = c >= 0 and scheme[:c]
-    if not scheme: scheme = None
     try:
-        ctor = protocols[scheme]
+        ctor = schemes.get(scheme) or schemes['file']
         if create:
             return ctor(ui, path, create)
         return ctor(ui, path)
-    except KeyError:
-        raise util.Abort(_('protocol "%s" not known') % scheme)
     except TypeError:
         raise util.Abort(_('cannot create new repository over "%s" protocol') %
-                         (scheme or 'file'))
+                         scheme)
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -617,7 +617,11 @@ class localrepository(object):
                     del mf[fn]
             return mf
 
-        if node1:
+        compareworking = False
+        if not node1 or node1 == self.dirstate.parents()[0]:
+            compareworking = True
+
+        if not compareworking:
             # read the manifest from node1 before the manifest from node2,
             # so that we'll hit the manifest cache if we're going through
             # all the revisions in parent->child order.
@@ -634,7 +638,7 @@ class localrepository(object):
                 self.dirstate.changes(files, match, show_ignored))
 
             # are we comparing working dir against its parent?
-            if not node1:
+            if compareworking:
                 if lookup:
                     # do a full compare of any files that might have changed
                     mf2 = mfmatches(self.dirstate.parents()[0])
@@ -657,11 +661,15 @@ class localrepository(object):
             deleted, unknown, ignored = [], [], []
             mf2 = mfmatches(node2)
 
-        if node1:
+        if not compareworking:
             # flush lists from dirstate before comparing manifests
             modified, added = [], []
 
-            for fn in mf2:
+            # make sure to sort the files so we talk to the disk in a
+            # reasonable order
+            mf2keys = mf2.keys()
+            mf2keys.sort()
+            for fn in mf2keys:
                 if mf1.has_key(fn):
                     if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)):
                         modified.append(fn)
--- a/mercurial/sshrepo.py
+++ b/mercurial/sshrepo.py
@@ -18,7 +18,7 @@ class sshrepository(remoterepository):
 
         m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path)
         if not m:
-            raise hg.RepoError(_("couldn't parse destination %s") % path)
+            raise hg.RepoError(_("couldn't parse location %s") % path)
 
         self.user = m.group(2)
         self.host = m.group(3)