##// END OF EJS Templates
correct the relative path when walking from a subdir...
Benoit Boissinot -
r1625:e1bcf7fa default
parent child Browse files
Show More
@@ -40,14 +40,14 b' def matchpats(repo, pats=[], opts={}, he'
40 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
40 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
41 cwd = ''
41 cwd = ''
42 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
42 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
43 opts.get('exclude'), head) + (cwd,)
43 opts.get('exclude'), head)
44
44
45 def makewalk(repo, pats, opts, node=None, head=''):
45 def makewalk(repo, pats, opts, node=None, head=''):
46 files, matchfn, anypats, cwd = matchpats(repo, pats, opts, head)
46 files, matchfn, anypats = matchpats(repo, pats, opts, head)
47 exact = dict(zip(files, files))
47 exact = dict(zip(files, files))
48 def walk():
48 def walk():
49 for src, fn in repo.walk(node=node, files=files, match=matchfn):
49 for src, fn in repo.walk(node=node, files=files, match=matchfn):
50 yield src, fn, util.pathto(cwd, fn), fn in exact
50 yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact
51 return files, matchfn, walk()
51 return files, matchfn, walk()
52
52
53 def walk(repo, pats, opts, node=None, head=''):
53 def walk(repo, pats, opts, node=None, head=''):
@@ -82,7 +82,7 b' def walkchangerevs(ui, repo, pats, opts)'
82 "iter", rev, None: in-order traversal of the revs earlier iterated
82 "iter", rev, None: in-order traversal of the revs earlier iterated
83 over with "add" - use to display data'''
83 over with "add" - use to display data'''
84
84
85 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
85 files, matchfn, anypats = matchpats(repo, pats, opts)
86
86
87 if repo.changelog.count() == 0:
87 if repo.changelog.count() == 0:
88 return [], False, matchfn
88 return [], False, matchfn
@@ -515,11 +515,11 b' def addremove(ui, repo, *pats, **opts):'
515 if src == 'f' and repo.dirstate.state(abs) == '?':
515 if src == 'f' and repo.dirstate.state(abs) == '?':
516 add.append(abs)
516 add.append(abs)
517 if ui.verbose or not exact:
517 if ui.verbose or not exact:
518 ui.status(_('adding %s\n') % rel)
518 ui.status(_('adding %s\n') % ((pats and rel) or abs))
519 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
519 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
520 remove.append(abs)
520 remove.append(abs)
521 if ui.verbose or not exact:
521 if ui.verbose or not exact:
522 ui.status(_('removing %s\n') % rel)
522 ui.status(_('removing %s\n') % ((pats and rel) or abs))
523 repo.add(add)
523 repo.add(add)
524 repo.remove(remove)
524 repo.remove(remove)
525
525
@@ -568,12 +568,13 b' def annotate(ui, repo, *pats, **opts):'
568
568
569 for src, abs, rel, exact in walk(repo, pats, opts):
569 for src, abs, rel, exact in walk(repo, pats, opts):
570 if abs not in mmap:
570 if abs not in mmap:
571 ui.warn(_("warning: %s is not in the repository!\n") % rel)
571 ui.warn(_("warning: %s is not in the repository!\n") %
572 ((pats and rel) or abs))
572 continue
573 continue
573
574
574 f = repo.file(abs)
575 f = repo.file(abs)
575 if not opts['text'] and util.binary(f.read(mmap[abs])):
576 if not opts['text'] and util.binary(f.read(mmap[abs])):
576 ui.write(_("%s: binary file\n") % rel)
577 ui.write(_("%s: binary file\n") % ((pats and rel) or abs))
577 continue
578 continue
578
579
579 lines = f.annotate(mmap[abs])
580 lines = f.annotate(mmap[abs])
@@ -783,7 +784,7 b' def commit(ui, repo, *pats, **opts):'
783
784
784 if opts['addremove']:
785 if opts['addremove']:
785 addremove(ui, repo, *pats, **opts)
786 addremove(ui, repo, *pats, **opts)
786 fns, match, anypats, cwd = matchpats(repo, pats, opts)
787 fns, match, anypats = matchpats(repo, pats, opts)
787 if pats:
788 if pats:
788 modified, added, removed, deleted, unknown = (
789 modified, added, removed, deleted, unknown = (
789 repo.changes(files=fns, match=match))
790 repo.changes(files=fns, match=match))
@@ -1122,7 +1123,7 b' def diff(ui, repo, *pats, **opts):'
1122 if len(revs) > 2:
1123 if len(revs) > 2:
1123 raise util.Abort(_("too many revisions to diff"))
1124 raise util.Abort(_("too many revisions to diff"))
1124
1125
1125 fns, matchfn, anypats, cwd = matchpats(repo, pats, opts)
1126 fns, matchfn, anypats = matchpats(repo, pats, opts)
1126
1127
1127 dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
1128 dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
1128 text=opts['text'])
1129 text=opts['text'])
@@ -1203,7 +1204,7 b' def forget(ui, repo, *pats, **opts):'
1203 if repo.dirstate.state(abs) == 'a':
1204 if repo.dirstate.state(abs) == 'a':
1204 forget.append(abs)
1205 forget.append(abs)
1205 if ui.verbose or not exact:
1206 if ui.verbose or not exact:
1206 ui.status(_('forgetting %s\n') % rel)
1207 ui.status(_('forgetting %s\n') % ((pats and rel) or abs))
1207 repo.forget(forget)
1208 repo.forget(forget)
1208
1209
1209 def grep(ui, repo, pattern, *pats, **opts):
1210 def grep(ui, repo, pattern, *pats, **opts):
@@ -1544,7 +1545,7 b' def locate(ui, repo, *pats, **opts):'
1544 if opts['fullpath']:
1545 if opts['fullpath']:
1545 ui.write(os.path.join(repo.root, abs), end)
1546 ui.write(os.path.join(repo.root, abs), end)
1546 else:
1547 else:
1547 ui.write(rel, end)
1548 ui.write(((pats and rel) or abs), end)
1548
1549
1549 def log(ui, repo, *pats, **opts):
1550 def log(ui, repo, *pats, **opts):
1550 """show revision history of entire repository or files
1551 """show revision history of entire repository or files
@@ -1898,7 +1899,7 b' def revert(ui, repo, *pats, **opts):'
1898 node = opts['rev'] and repo.lookup(opts['rev']) or \
1899 node = opts['rev'] and repo.lookup(opts['rev']) or \
1899 repo.dirstate.parents()[0]
1900 repo.dirstate.parents()[0]
1900
1901
1901 files, choose, anypats, cwd = matchpats(repo, pats, opts)
1902 files, choose, anypats = matchpats(repo, pats, opts)
1902 modified, added, removed, deleted, unknown = repo.changes(match=choose)
1903 modified, added, removed, deleted, unknown = repo.changes(match=choose)
1903 repo.forget(added)
1904 repo.forget(added)
1904 repo.undelete(removed + deleted)
1905 repo.undelete(removed + deleted)
@@ -2032,7 +2033,8 b' def status(ui, repo, *pats, **opts):'
2032 ? = not tracked
2033 ? = not tracked
2033 """
2034 """
2034
2035
2035 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
2036 files, matchfn, anypats = matchpats(repo, pats, opts)
2037 cwd = (pats and repo.getcwd()) or ''
2036 modified, added, removed, deleted, unknown = [
2038 modified, added, removed, deleted, unknown = [
2037 [util.pathto(cwd, x) for x in n]
2039 [util.pathto(cwd, x) for x in n]
2038 for n in repo.changes(files=files, match=matchfn)]
2040 for n in repo.changes(files=files, match=matchfn)]
General Comments 0
You need to be logged in to leave comments. Login now