##// END OF EJS Templates
use 'x is None' instead of 'x == None'...
Martin Geisler -
r8527:f9a80054 default
parent child Browse files
Show More
@@ -37,13 +37,13 b' def buildlist(names, top):'
37 37 names[os.path.join(l, x)] = (st.st_dev, st.st_ino)
38 38
39 39 def diff_files(file1, file2):
40 if file1 == None:
40 if file1 is None:
41 41 b = file(file2).read().splitlines(1)
42 42 l1 = "--- %s\n" % (file2)
43 43 l2 = "+++ %s\n" % (file2)
44 44 l3 = "@@ -0,0 +1,%d @@\n" % len(b)
45 45 l = [l1, l2, l3] + ["+" + e for e in b]
46 elif file2 == None:
46 elif file2 is None:
47 47 a = file(file1).read().splitlines(1)
48 48 l1 = "--- %s\n" % (file1)
49 49 l2 = "+++ %s\n" % (file1)
@@ -143,7 +143,7 b' def bookmark(ui, repo, mark=None, rev=No'
143 143 return
144 144
145 145 if delete:
146 if mark == None:
146 if mark is None:
147 147 raise util.Abort(_("bookmark name required"))
148 148 if mark not in marks:
149 149 raise util.Abort(_("a bookmark of this name does not exist"))
@@ -171,7 +171,7 b' def bookmark(ui, repo, mark=None, rev=No'
171 171 write(repo, marks)
172 172 return
173 173
174 if mark == None:
174 if mark is None:
175 175 if rev:
176 176 raise util.Abort(_("bookmark name required"))
177 177 if len(marks) == 0:
@@ -243,7 +243,7 b' def reposetup(ui, repo):'
243 243 """Add a revision to the repository and
244 244 move the bookmark"""
245 245 node = super(bookmark_repo, self).commit(*k, **kw)
246 if node == None:
246 if node is None:
247 247 return None
248 248 parents = repo.changelog.parents(node)
249 249 if parents[1] == nullid:
@@ -430,7 +430,7 b' class queue:'
430 430 if ret:
431 431 raise util.Abort(_("update returned %d") % ret)
432 432 n = repo.commit(None, ctx.description(), ctx.user(), force=1)
433 if n == None:
433 if n is None:
434 434 raise util.Abort(_("repo commit failed"))
435 435 try:
436 436 ph = mergeq.readheaders(patch)
@@ -603,7 +603,7 b' class queue:'
603 603 n = repo.commit(files, message, ph.user, ph.date, match=match,
604 604 force=True)
605 605
606 if n == None:
606 if n is None:
607 607 raise util.Abort(_("repo commit failed"))
608 608
609 609 if update_status:
@@ -767,7 +767,7 b' class queue:'
767 767 msg = msg()
768 768 commitmsg = msg and msg or ("[mq]: %s" % patchfn)
769 769 n = repo.commit(commitfiles, commitmsg, user, date, match=match, force=True)
770 if n == None:
770 if n is None:
771 771 raise util.Abort(_("repo commit failed"))
772 772 try:
773 773 self.full_series[insert:insert] = [patchfn]
@@ -860,7 +860,7 b' class queue:'
860 860 return self.series[0]
861 861 return None
862 862
863 if patch == None:
863 if patch is None:
864 864 return None
865 865 if patch in self.series:
866 866 return patch
@@ -1422,7 +1422,7 b' class queue:'
1422 1422 applied.append(se)
1423 1423 else:
1424 1424 series.append(file_)
1425 if datastart == None:
1425 if datastart is None:
1426 1426 self.ui.warn(_("No saved patch data found\n"))
1427 1427 return 1
1428 1428 self.ui.warn(_("restoring status: %s\n") % lines[0])
@@ -1486,7 +1486,7 b' class queue:'
1486 1486 if len(self.applied) > 0:
1487 1487 p = self.applied[-1].name
1488 1488 end = self.find_series(p)
1489 if end == None:
1489 if end is None:
1490 1490 return len(self.full_series)
1491 1491 return end + 1
1492 1492 return 0
@@ -2090,7 +2090,7 b' def lastsavename(path):'
2090 2090 m = namere.match(f)
2091 2091 if m:
2092 2092 index = int(m.group(1))
2093 if maxindex == None or index > maxindex:
2093 if maxindex is None or index > maxindex:
2094 2094 maxindex = index
2095 2095 maxname = f
2096 2096 if maxname:
@@ -44,7 +44,7 b' class tarit:'
44 44 timestamp = None
45 45 if 'timestamp' in kw:
46 46 timestamp = kw.pop('timestamp')
47 if timestamp == None:
47 if timestamp is None:
48 48 self.timestamp = time.time()
49 49 else:
50 50 self.timestamp = timestamp
@@ -444,7 +444,7 b' class filectx(object):'
444 444
445 445 # prime the ancestor cache for the working directory
446 446 for c in (self, fc2):
447 if c._filerev == None:
447 if c._filerev is None:
448 448 pl = [(n.path(), n.filenode()) for n in c.parents()]
449 449 acache[(c._path, None)] = pl
450 450
@@ -106,7 +106,7 b' def copies(repo, c1, c2, ca, checkdirs=F'
106 106 return {}, {}
107 107
108 108 # avoid silly behavior for parent -> working dir
109 if c2.node() == None and c1.node() == repo.dirstate.parents()[0]:
109 if c2.node() is None and c1.node() == repo.dirstate.parents()[0]:
110 110 return repo.dirstate.copies(), {}
111 111
112 112 limit = _findlimit(repo, c1.rev(), c2.rev())
@@ -107,7 +107,7 b' class localrepository(repo.repository):'
107 107 return dirstate.dirstate(self.opener, self.ui, self.root)
108 108
109 109 def __getitem__(self, changeid):
110 if changeid == None:
110 if changeid is None:
111 111 return context.workingctx(self)
112 112 return context.changectx(self, changeid)
113 113
@@ -1209,7 +1209,7 b' class localrepository(repo.repository):'
1209 1209 fetch = set()
1210 1210 seen = set()
1211 1211 seenbranch = set()
1212 if base == None:
1212 if base is None:
1213 1213 base = {}
1214 1214
1215 1215 if not heads:
@@ -1341,7 +1341,7 b' class localrepository(repo.repository):'
1341 1341 or ancestors of these heads, and return a second element which
1342 1342 contains all remote heads which get new children.
1343 1343 """
1344 if base == None:
1344 if base is None:
1345 1345 base = {}
1346 1346 self.findincoming(remote, base, heads, force=force)
1347 1347
@@ -452,11 +452,11 b' class hunk:'
452 452 if not m:
453 453 raise PatchError(_("bad hunk #%d") % self.number)
454 454 self.starta, foo, self.lena, self.startb, foo2, self.lenb = m.groups()
455 if self.lena == None:
455 if self.lena is None:
456 456 self.lena = 1
457 457 else:
458 458 self.lena = int(self.lena)
459 if self.lenb == None:
459 if self.lenb is None:
460 460 self.lenb = 1
461 461 else:
462 462 self.lenb = int(self.lenb)
@@ -479,7 +479,7 b' class hunk:'
479 479 raise PatchError(_("bad hunk #%d") % self.number)
480 480 foo, self.starta, foo2, aend, foo3 = m.groups()
481 481 self.starta = int(self.starta)
482 if aend == None:
482 if aend is None:
483 483 aend = self.starta
484 484 self.lena = int(aend) - self.starta
485 485 if self.starta:
@@ -511,7 +511,7 b' class hunk:'
511 511 raise PatchError(_("bad hunk #%d") % self.number)
512 512 foo, self.startb, foo2, bend, foo3 = m.groups()
513 513 self.startb = int(self.startb)
514 if bend == None:
514 if bend is None:
515 515 bend = self.startb
516 516 self.lenb = int(bend) - self.startb
517 517 if self.startb:
@@ -872,7 +872,7 b' def iterhunks(ui, fp, sourcefile=None):'
872 872 if ((sourcefile or state == BFILE) and ((not context and x[0] == '@') or
873 873 ((context is not False) and x.startswith('***************')))):
874 874 try:
875 if context == None and x.startswith('***************'):
875 if context is None and x.startswith('***************'):
876 876 context = True
877 877 gpatch = changed.get(bfile)
878 878 create = afile == '/dev/null' or gpatch and gpatch.op == 'ADD'
@@ -175,7 +175,7 b' class lazyparser(object):'
175 175 if lend > len(self.index) - i:
176 176 lend = len(self.index) - i
177 177 for x in xrange(lend):
178 if self.index[i + x] == None:
178 if self.index[i + x] is None:
179 179 b = data[off : off + self.s]
180 180 self.index[i + x] = b
181 181 n = b[ngshaoffset:ngshaoffset + 20]
@@ -231,7 +231,7 b' class lazyparser(object):'
231 231 if self.all:
232 232 return
233 233 all = False
234 if i == None:
234 if i is None:
235 235 blockstart = 0
236 236 blocksize = (65536 / self.s) * self.s
237 237 end = self.datasize
@@ -279,7 +279,7 b' class lazymap(object):'
279 279 self.p = parser
280 280 def load(self, key):
281 281 n = self.p.findnode(key)
282 if n == None:
282 if n is None:
283 283 raise KeyError(key)
284 284 def __contains__(self, key):
285 285 if key in self.p.map:
@@ -1019,7 +1019,7 b' class revlog(object):'
1019 1019 return
1020 1020
1021 1021 trinfo = tr.find(self.indexfile)
1022 if trinfo == None:
1022 if trinfo is None:
1023 1023 raise RevlogError(_("%s not found in the transaction")
1024 1024 % self.indexfile)
1025 1025
@@ -129,7 +129,7 b' class ui(object):'
129 129
130 130 def configbool(self, section, name, default=False, untrusted=False):
131 131 v = self.config(section, name, None, untrusted)
132 if v == None:
132 if v is None:
133 133 return default
134 134 if v.lower() not in _booleans:
135 135 raise error.ConfigError(_("%s.%s not a boolean ('%s')")
General Comments 0
You need to be logged in to leave comments. Login now