diff mercurial/hg.py @ 686:d7d68d27ebe5

Reapply startswith() changes that got lost with stale edit manifest hash: 16d7feedd561591a21727a4c13a1223019d802a7
author Matt Mackall <mpm@selenic.com>
date Tue, 12 Jul 2005 00:51:49 -0800
parents 32b6bbf1c37b
children f762860f82c6
line wrap: on
line diff
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -21,14 +21,14 @@ class filelog(revlog):
 
     def read(self, node):
         t = self.revision(node)
-        if t[:2] != '\1\n':
+        if not t.startswith('\1\n'):
             return t
         s = t.find('\1\n', 2)
         return t[s+2:]
 
     def readmeta(self, node):
         t = self.revision(node)
-        if t[:2] != '\1\n':
+        if not t.startswith('\1\n'):
             return t
         s = t.find('\1\n', 2)
         mt = t[2:s]
@@ -38,7 +38,7 @@ class filelog(revlog):
         return m
 
     def add(self, text, meta, transaction, link, p1=None, p2=None):
-        if meta or text[:2] == '\1\n':
+        if meta or text.startswith('\1\n'):
             mt = ""
             if meta:
                 mt = [ "%s: %s\n" % (k, v) for k,v in meta.items() ]
@@ -436,7 +436,7 @@ class dirstate:
 def opener(base):
     p = base
     def o(path, mode="r"):
-        if p[:7] == "http://":
+        if p.startswith("http://"):
             f = os.path.join(p, urllib.quote(path))
             return httprangereader.httprangereader(f)
 
@@ -465,7 +465,7 @@ class RepoError(Exception): pass
 class localrepository:
     def __init__(self, ui, path=None, create=0):
         self.remote = 0
-        if path and path[:7] == "http://":
+        if path and path.startswith("http://"):
             self.remote = 1
             self.path = path
         else: