##// END OF EJS Templates
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein -
r1618:ff339dd2 default
parent child Browse files
Show More
@@ -21,8 +21,8 b' def lookup_rev(ui, repo, rev=None):'
21 21 return parents.pop()
22 22
23 23 def check_clean(ui, repo):
24 c, a, d, u = repo.changes()
25 if c or a or d:
24 modified, added, removed, unknown = repo.changes()
25 if modified or added or removed:
26 26 ui.warn("Repository is not clean, please commit or revert\n")
27 27 sys.exit(1)
28 28
@@ -14,13 +14,13 b' def dodiff(fp, ui, repo, node1, node2, f'
14 14 return time.asctime(time.gmtime(c[2][0]))
15 15
16 16 if not changes:
17 (c, a, d, u) = repo.changes(node1, node2, files, match=match)
18 else:
19 (c, a, d, u) = changes
17 changes = repo.changes(node1, node2, files, match=match)
18 modified, added, removed, unknown = changes
20 19 if files:
21 c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
20 modified, added, removed = map(lambda x: filterfiles(x, files),
21 (modified, added, removed))
22 22
23 if not c and not a and not d:
23 if not modified and not added and not removed:
24 24 return
25 25
26 26 if node2:
@@ -40,19 +40,19 b' def dodiff(fp, ui, repo, node1, node2, f'
40 40 mmap = repo.manifest.read(change[0])
41 41 date1 = date(change)
42 42
43 for f in c:
43 for f in modified:
44 44 to = None
45 45 if f in mmap:
46 46 to = repo.file(f).read(mmap[f])
47 47 tn = read(f)
48 48 fp.write("diff --git a/%s b/%s\n" % (f, f))
49 49 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text))
50 for f in a:
50 for f in added:
51 51 to = None
52 52 tn = read(f)
53 53 fp.write("diff --git /dev/null b/%s\n" % (f))
54 54 fp.write(mdiff.unidiff(to, date1, tn, date2, f, None, text=text))
55 for f in d:
55 for f in removed:
56 56 to = repo.file(f).read(mmap[f])
57 57 tn = None
58 58 fp.write("diff --git a/%s /dev/null\n" % (f))
@@ -67,12 +67,12 b' def difftree(ui, repo, node1=None, node2'
67 67 if node2:
68 68 change = repo.changelog.read(node2)
69 69 mmap2 = repo.manifest.read(change[0])
70 (c, a, d, u) = repo.changes(node1, node2)
70 modified, added, removed, unknown = repo.changes(node1, node2)
71 71 def read(f): return repo.file(f).read(mmap2[f])
72 72 date2 = date(change)
73 73 else:
74 74 date2 = time.asctime()
75 (c, a, d, u) = repo.changes(node1, None)
75 modified, added, removed, unknown = repo.changes(node1)
76 76 if not node1:
77 77 node1 = repo.dirstate.parents()[0]
78 78 def read(f): return file(os.path.join(repo.root, f)).read()
@@ -82,13 +82,13 b' def difftree(ui, repo, node1=None, node2'
82 82 date1 = date(change)
83 83 empty = "0" * 40;
84 84
85 for f in c:
85 for f in modified:
86 86 # TODO get file permissions
87 87 print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]),
88 88 hg.hex(mmap2[f]), f, f)
89 for f in a:
89 for f in added:
90 90 print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f)
91 for f in d:
91 for f in removed:
92 92 print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f)
93 93 ##
94 94
@@ -160,8 +160,7 b' def sign(ui, repo, *revs, **opts):'
160 160 repo.opener("localsigs", "ab").write(sigmessage)
161 161 return
162 162
163 (c, a, d, u) = repo.changes()
164 for x in (c, a, d, u):
163 for x in repo.changes():
165 164 if ".hgsigs" in x and not opts["force"]:
166 165 raise util.Abort("working copy of .hgsigs is changed "
167 166 "(please commit .hgsigs manually"
@@ -263,13 +263,13 b' def make_file(repo, r, pat, node=None,'
263 263 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
264 264 changes=None, text=False):
265 265 if not changes:
266 (c, a, d, u) = repo.changes(node1, node2, files, match=match)
267 else:
268 (c, a, d, u) = changes
266 changes = repo.changes(node1, node2, files, match=match)
267 modified, added, removed, unknown = changes
269 268 if files:
270 c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
269 modified, added, removed = map(lambda x: filterfiles(x, files),
270 (modified, added, removed))
271 271
272 if not c and not a and not d:
272 if not modified and not added and not removed:
273 273 return
274 274
275 275 if node2:
@@ -295,17 +295,17 b' def dodiff(fp, ui, repo, node1, node2, f'
295 295 mmap = repo.manifest.read(change[0])
296 296 date1 = util.datestr(change[2])
297 297
298 for f in c:
298 for f in modified:
299 299 to = None
300 300 if f in mmap:
301 301 to = repo.file(f).read(mmap[f])
302 302 tn = read(f)
303 303 fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text))
304 for f in a:
304 for f in added:
305 305 to = None
306 306 tn = read(f)
307 307 fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text))
308 for f in d:
308 for f in removed:
309 309 to = repo.file(f).read(mmap[f])
310 310 tn = None
311 311 fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text))
@@ -785,8 +785,10 b' def commit(ui, repo, *pats, **opts):'
785 785 addremove(ui, repo, *pats, **opts)
786 786 fns, match, anypats, cwd = matchpats(repo, pats, opts)
787 787 if pats:
788 c, a, d, u = repo.changes(files=fns, match=match)
789 files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
788 modified, added, removed, unknown = (
789 repo.changes(files=fns, match=match))
790 files = (modified + added +
791 [fn for fn in removed if repo.dirstate.state(fn) == 'r'])
790 792 else:
791 793 files = []
792 794 try:
@@ -1379,9 +1381,9 b' def identify(ui, repo):'
1379 1381 return
1380 1382
1381 1383 hexfunc = ui.verbose and hex or short
1382 (c, a, d, u) = repo.changes()
1384 modified, added, removed, unknown = repo.changes()
1383 1385 output = ["%s%s" % ('+'.join([hexfunc(parent) for parent in parents]),
1384 (c or a or d) and "+" or "")]
1386 (modified or added or removed) and "+" or "")]
1385 1387
1386 1388 if not ui.quiet:
1387 1389 # multiple tags for a single parent separated by '/'
@@ -1410,8 +1412,8 b' def import_(ui, repo, patch1, *patches, '
1410 1412 patches = (patch1,) + patches
1411 1413
1412 1414 if not opts['force']:
1413 (c, a, d, u) = repo.changes()
1414 if c or a or d:
1415 modified, added, removed, unknown = repo.changes()
1416 if modified or added or removed:
1415 1417 raise util.Abort(_("outstanding uncommitted changes"))
1416 1418
1417 1419 d = opts["base"]
@@ -1827,13 +1829,13 b' def remove(ui, repo, pat, *pats, **opts)'
1827 1829 """
1828 1830 names = []
1829 1831 def okaytoremove(abs, rel, exact):
1830 c, a, d, u = repo.changes(files = [abs])
1832 modified, added, removed, unknown = repo.changes(files=[abs])
1831 1833 reason = None
1832 if c:
1834 if modified:
1833 1835 reason = _('is modified')
1834 elif a:
1836 elif added:
1835 1837 reason = _('has been marked for add')
1836 elif u:
1838 elif unknown:
1837 1839 reason = _('is not managed')
1838 1840 if reason:
1839 1841 if exact:
@@ -1891,9 +1893,9 b' def revert(ui, repo, *pats, **opts):'
1891 1893 repo.dirstate.parents()[0]
1892 1894
1893 1895 files, choose, anypats, cwd = matchpats(repo, pats, opts)
1894 (c, a, d, u) = repo.changes(match=choose)
1895 repo.forget(a)
1896 repo.undelete(d)
1896 modified, added, removed, unknown = repo.changes(match=choose)
1897 repo.forget(added)
1898 repo.undelete(removed)
1897 1899
1898 1900 return repo.update(node, False, True, choose, False)
1899 1901
@@ -2024,13 +2026,14 b' def status(ui, repo, *pats, **opts):'
2024 2026 """
2025 2027
2026 2028 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
2027 (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
2028 for n in repo.changes(files=files, match=matchfn)]
2029 modified, added, removed, unknown = [
2030 [util.pathto(cwd, x) for x in n]
2031 for n in repo.changes(files=files, match=matchfn)]
2029 2032
2030 changetypes = [(_('modified'), 'M', c),
2031 (_('added'), 'A', a),
2032 (_('removed'), 'R', d),
2033 (_('unknown'), '?', u)]
2033 changetypes = [(_('modified'), 'M', modified),
2034 (_('added'), 'A', added),
2035 (_('removed'), 'R', removed),
2036 (_('unknown'), '?', unknown)]
2034 2037
2035 2038 end = opts['print0'] and '\0' or '\n'
2036 2039
@@ -2078,8 +2081,7 b' def tag(ui, repo, name, rev_=None, **opt'
2078 2081 repo.opener("localtags", "a").write("%s %s\n" % (r, name))
2079 2082 return
2080 2083
2081 (c, a, d, u) = repo.changes()
2082 for x in (c, a, d, u):
2084 for x in repo.changes():
2083 2085 if ".hgtags" in x:
2084 2086 raise util.Abort(_("working copy of .hgtags is changed "
2085 2087 "(please commit .hgtags manually)"))
@@ -265,19 +265,20 b' class hgweb(object):'
265 265 date1 = util.datestr(change1[2])
266 266 date2 = util.datestr(change2[2])
267 267
268 c, a, d, u = r.changes(node1, node2)
268 modified, added, removed, unknown = r.changes(node1, node2)
269 269 if files:
270 c, a, d = map(lambda x: filterfiles(x, files), (c, a, d))
270 modified, added, removed = map(lambda x: filterfiles(x, files),
271 (modified, added, removed))
271 272
272 for f in c:
273 for f in modified:
273 274 to = r.file(f).read(mmap1[f])
274 275 tn = r.file(f).read(mmap2[f])
275 276 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn)
276 for f in a:
277 for f in added:
277 278 to = None
278 279 tn = r.file(f).read(mmap2[f])
279 280 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn)
280 for f in d:
281 for f in removed:
281 282 to = r.file(f).read(mmap1[f])
282 283 tn = None
283 284 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn)
@@ -355,9 +355,9 b' class localrepository(object):'
355 355 else:
356 356 self.ui.warn(_("%s not tracked!\n") % f)
357 357 else:
358 (c, a, d, u) = self.changes(match=match)
359 commit = c + a
360 remove = d
358 modified, added, removed, unknown = self.changes(match=match)
359 commit = modified + added
360 remove = removed
361 361
362 362 p1, p2 = self.dirstate.parents()
363 363 c1 = self.changelog.read(p1)
@@ -1392,13 +1392,13 b' class localrepository(object):'
1392 1392 ma = self.manifest.read(man)
1393 1393 mfa = self.manifest.readflags(man)
1394 1394
1395 (c, a, d, u) = self.changes()
1395 modified, added, removed, unknown = self.changes()
1396 1396
1397 1397 if allow and not forcemerge:
1398 if c or a or d:
1398 if modified or added or removed:
1399 1399 raise util.Abort(_("outstanding uncommited changes"))
1400 1400 if not forcemerge and not force:
1401 for f in u:
1401 for f in unknown:
1402 1402 if f in m2:
1403 1403 t1 = self.wread(f)
1404 1404 t2 = self.file(f).read(m2[f])
@@ -1425,16 +1425,16 b' class localrepository(object):'
1425 1425 # construct a working dir manifest
1426 1426 mw = m1.copy()
1427 1427 mfw = mf1.copy()
1428 umap = dict.fromkeys(u)
1428 umap = dict.fromkeys(unknown)
1429 1429
1430 for f in a + c + u:
1430 for f in added + modified + unknown:
1431 1431 mw[f] = ""
1432 1432 mfw[f] = util.is_exec(self.wjoin(f), mfw.get(f, False))
1433 1433
1434 1434 if moddirstate:
1435 1435 wlock = self.wlock()
1436 1436
1437 for f in d:
1437 for f in removed:
1438 1438 if f in mw:
1439 1439 del mw[f]
1440 1440
General Comments 0
You need to be logged in to leave comments. Login now