##// END OF EJS Templates
Distinguish removed and deleted files. Tests are not fixed yet....
Thomas Arendsen Hein -
r1619:1ba0d704 default
parent child Browse files
Show More
@@ -21,7 +21,7 b' def lookup_rev(ui, repo, rev=None):'
21 return parents.pop()
21 return parents.pop()
22
22
23 def check_clean(ui, repo):
23 def check_clean(ui, repo):
24 modified, added, removed, unknown = repo.changes()
24 modified, added, removed, deleted, unknown = repo.changes()
25 if modified or added or removed:
25 if modified or added or removed:
26 ui.warn("Repository is not clean, please commit or revert\n")
26 ui.warn("Repository is not clean, please commit or revert\n")
27 sys.exit(1)
27 sys.exit(1)
@@ -15,7 +15,7 b' def dodiff(fp, ui, repo, node1, node2, f'
15
15
16 if not changes:
16 if not changes:
17 changes = repo.changes(node1, node2, files, match=match)
17 changes = repo.changes(node1, node2, files, match=match)
18 modified, added, removed, unknown = changes
18 modified, added, removed, deleted, unknown = changes
19 if files:
19 if files:
20 modified, added, removed = map(lambda x: filterfiles(x, files),
20 modified, added, removed = map(lambda x: filterfiles(x, files),
21 (modified, added, removed))
21 (modified, added, removed))
@@ -67,12 +67,12 b' def difftree(ui, repo, node1=None, node2'
67 if node2:
67 if node2:
68 change = repo.changelog.read(node2)
68 change = repo.changelog.read(node2)
69 mmap2 = repo.manifest.read(change[0])
69 mmap2 = repo.manifest.read(change[0])
70 modified, added, removed, unknown = repo.changes(node1, node2)
70 modified, added, removed, deleted, unknown = repo.changes(node1, node2)
71 def read(f): return repo.file(f).read(mmap2[f])
71 def read(f): return repo.file(f).read(mmap2[f])
72 date2 = date(change)
72 date2 = date(change)
73 else:
73 else:
74 date2 = time.asctime()
74 date2 = time.asctime()
75 modified, added, removed, unknown = repo.changes(node1)
75 modified, added, removed, deleted, unknown = repo.changes(node1)
76 if not node1:
76 if not node1:
77 node1 = repo.dirstate.parents()[0]
77 node1 = repo.dirstate.parents()[0]
78 def read(f): return file(os.path.join(repo.root, f)).read()
78 def read(f): return file(os.path.join(repo.root, f)).read()
@@ -264,7 +264,7 b' def dodiff(fp, ui, repo, node1, node2, f'
264 changes=None, text=False):
264 changes=None, text=False):
265 if not changes:
265 if not changes:
266 changes = repo.changes(node1, node2, files, match=match)
266 changes = repo.changes(node1, node2, files, match=match)
267 modified, added, removed, unknown = changes
267 modified, added, removed, deleted, unknown = changes
268 if files:
268 if files:
269 modified, added, removed = map(lambda x: filterfiles(x, files),
269 modified, added, removed = map(lambda x: filterfiles(x, files),
270 (modified, added, removed))
270 (modified, added, removed))
@@ -785,10 +785,9 b' def commit(ui, repo, *pats, **opts):'
785 addremove(ui, repo, *pats, **opts)
785 addremove(ui, repo, *pats, **opts)
786 fns, match, anypats, cwd = matchpats(repo, pats, opts)
786 fns, match, anypats, cwd = matchpats(repo, pats, opts)
787 if pats:
787 if pats:
788 modified, added, removed, unknown = (
788 modified, added, removed, deleted, unknown = (
789 repo.changes(files=fns, match=match))
789 repo.changes(files=fns, match=match))
790 files = (modified + added +
790 files = modified + added + removed
791 [fn for fn in removed if repo.dirstate.state(fn) == 'r'])
792 else:
791 else:
793 files = []
792 files = []
794 try:
793 try:
@@ -1381,9 +1380,10 b' def identify(ui, repo):'
1381 return
1380 return
1382
1381
1383 hexfunc = ui.verbose and hex or short
1382 hexfunc = ui.verbose and hex or short
1384 modified, added, removed, unknown = repo.changes()
1383 modified, added, removed, deleted, unknown = repo.changes()
1385 output = ["%s%s" % ('+'.join([hexfunc(parent) for parent in parents]),
1384 output = ["%s%s" %
1386 (modified or added or removed) and "+" or "")]
1385 ('+'.join([hexfunc(parent) for parent in parents]),
1386 (modified or added or removed or deleted) and "+" or "")]
1387
1387
1388 if not ui.quiet:
1388 if not ui.quiet:
1389 # multiple tags for a single parent separated by '/'
1389 # multiple tags for a single parent separated by '/'
@@ -1412,8 +1412,8 b' def import_(ui, repo, patch1, *patches, '
1412 patches = (patch1,) + patches
1412 patches = (patch1,) + patches
1413
1413
1414 if not opts['force']:
1414 if not opts['force']:
1415 modified, added, removed, unknown = repo.changes()
1415 modified, added, removed, deleted, unknown = repo.changes()
1416 if modified or added or removed:
1416 if modified or added or removed or deleted:
1417 raise util.Abort(_("outstanding uncommitted changes"))
1417 raise util.Abort(_("outstanding uncommitted changes"))
1418
1418
1419 d = opts["base"]
1419 d = opts["base"]
@@ -1829,7 +1829,7 b' def remove(ui, repo, pat, *pats, **opts)'
1829 """
1829 """
1830 names = []
1830 names = []
1831 def okaytoremove(abs, rel, exact):
1831 def okaytoremove(abs, rel, exact):
1832 modified, added, removed, unknown = repo.changes(files=[abs])
1832 modified, added, removed, deleted, unknown = repo.changes(files=[abs])
1833 reason = None
1833 reason = None
1834 if modified:
1834 if modified:
1835 reason = _('is modified')
1835 reason = _('is modified')
@@ -1893,9 +1893,9 b' def revert(ui, repo, *pats, **opts):'
1893 repo.dirstate.parents()[0]
1893 repo.dirstate.parents()[0]
1894
1894
1895 files, choose, anypats, cwd = matchpats(repo, pats, opts)
1895 files, choose, anypats, cwd = matchpats(repo, pats, opts)
1896 modified, added, removed, unknown = repo.changes(match=choose)
1896 modified, added, removed, deleted, unknown = repo.changes(match=choose)
1897 repo.forget(added)
1897 repo.forget(added)
1898 repo.undelete(removed)
1898 repo.undelete(removed + deleted)
1899
1899
1900 return repo.update(node, False, True, choose, False)
1900 return repo.update(node, False, True, choose, False)
1901
1901
@@ -2022,17 +2022,19 b' def status(ui, repo, *pats, **opts):'
2022 M = modified
2022 M = modified
2023 A = added
2023 A = added
2024 R = removed
2024 R = removed
2025 ! = deleted, but still tracked
2025 ? = not tracked
2026 ? = not tracked
2026 """
2027 """
2027
2028
2028 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
2029 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
2029 modified, added, removed, unknown = [
2030 modified, added, removed, deleted, unknown = [
2030 [util.pathto(cwd, x) for x in n]
2031 [util.pathto(cwd, x) for x in n]
2031 for n in repo.changes(files=files, match=matchfn)]
2032 for n in repo.changes(files=files, match=matchfn)]
2032
2033
2033 changetypes = [(_('modified'), 'M', modified),
2034 changetypes = [(_('modified'), 'M', modified),
2034 (_('added'), 'A', added),
2035 (_('added'), 'A', added),
2035 (_('removed'), 'R', removed),
2036 (_('removed'), 'R', removed),
2037 (_('deleted'), '!', deleted),
2036 (_('unknown'), '?', unknown)]
2038 (_('unknown'), '?', unknown)]
2037
2039
2038 end = opts['print0'] and '\0' or '\n'
2040 end = opts['print0'] and '\0' or '\n'
@@ -2437,6 +2439,7 b' table = {'
2437 [('m', 'modified', None, _('show only modified files')),
2439 [('m', 'modified', None, _('show only modified files')),
2438 ('a', 'added', None, _('show only added files')),
2440 ('a', 'added', None, _('show only added files')),
2439 ('r', 'removed', None, _('show only removed files')),
2441 ('r', 'removed', None, _('show only removed files')),
2442 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
2440 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
2443 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
2441 ('n', 'no-status', None, _('hide status prefix')),
2444 ('n', 'no-status', None, _('hide status prefix')),
2442 ('0', 'print0', None,
2445 ('0', 'print0', None,
@@ -265,7 +265,7 b' class hgweb(object):'
265 date1 = util.datestr(change1[2])
265 date1 = util.datestr(change1[2])
266 date2 = util.datestr(change2[2])
266 date2 = util.datestr(change2[2])
267
267
268 modified, added, removed, unknown = r.changes(node1, node2)
268 modified, added, removed, deleted, unknown = r.changes(node1, node2)
269 if files:
269 if files:
270 modified, added, removed = map(lambda x: filterfiles(x, files),
270 modified, added, removed = map(lambda x: filterfiles(x, files),
271 (modified, added, removed))
271 (modified, added, removed))
@@ -355,7 +355,7 b' class localrepository(object):'
355 else:
355 else:
356 self.ui.warn(_("%s not tracked!\n") % f)
356 self.ui.warn(_("%s not tracked!\n") % f)
357 else:
357 else:
358 modified, added, removed, unknown = self.changes(match=match)
358 modified, added, removed, deleted, unknown = self.changes(match=match)
359 commit = modified + added
359 commit = modified + added
360 remove = removed
360 remove = removed
361
361
@@ -544,12 +544,10 b' class localrepository(object):'
544
544
545 removed = mf1.keys()
545 removed = mf1.keys()
546
546
547 removed.extend(deleted) #XXX get rid of this when returning deleted
548
549 # sort and return results:
547 # sort and return results:
550 for l in modified, added, removed, unknown:
548 for l in modified, added, removed, deleted, unknown:
551 l.sort()
549 l.sort()
552 return (modified, added, removed, unknown)
550 return (modified, added, removed, deleted, unknown)
553
551
554 def add(self, list):
552 def add(self, list):
555 wlock = self.wlock()
553 wlock = self.wlock()
@@ -1392,7 +1390,7 b' class localrepository(object):'
1392 ma = self.manifest.read(man)
1390 ma = self.manifest.read(man)
1393 mfa = self.manifest.readflags(man)
1391 mfa = self.manifest.readflags(man)
1394
1392
1395 modified, added, removed, unknown = self.changes()
1393 modified, added, removed, deleted, unknown = self.changes()
1396
1394
1397 if allow and not forcemerge:
1395 if allow and not forcemerge:
1398 if modified or added or removed:
1396 if modified or added or removed:
@@ -1434,7 +1432,7 b' class localrepository(object):'
1434 if moddirstate:
1432 if moddirstate:
1435 wlock = self.wlock()
1433 wlock = self.wlock()
1436
1434
1437 for f in removed:
1435 for f in deleted:
1438 if f in mw:
1436 if f in mw:
1439 del mw[f]
1437 del mw[f]
1440
1438
General Comments 0
You need to be logged in to leave comments. Login now