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