##// END OF EJS Templates
Merge with MPM.
Bryan O'Sullivan -
r946:6d21a348 merge default
parent child Browse files
Show More
@@ -42,9 +42,10 b' def matchpats(repo, cwd, pats = [], opts'
42 def makewalk(repo, pats, opts, head = ''):
42 def makewalk(repo, pats, opts, head = ''):
43 cwd = repo.getcwd()
43 cwd = repo.getcwd()
44 files, matchfn = matchpats(repo, cwd, pats, opts, head)
44 files, matchfn = matchpats(repo, cwd, pats, opts, head)
45 exact = dict(zip(files, files))
45 def walk():
46 def walk():
46 for src, fn in repo.walk(files = files, match = matchfn):
47 for src, fn in repo.walk(files = files, match = matchfn):
47 yield src, fn, util.pathto(cwd, fn)
48 yield src, fn, util.pathto(cwd, fn), fn in exact
48 return files, matchfn, walk()
49 return files, matchfn, walk()
49
50
50 def walk(repo, pats, opts, head = ''):
51 def walk(repo, pats, opts, head = ''):
@@ -375,9 +376,8 b' def help_(ui, cmd=None):'
375 def add(ui, repo, *pats, **opts):
376 def add(ui, repo, *pats, **opts):
376 '''add the specified files on the next commit'''
377 '''add the specified files on the next commit'''
377 names = []
378 names = []
378 q = dict(zip(pats, pats))
379 for src, abs, rel, exact in walk(repo, pats, opts):
379 for src, abs, rel in walk(repo, pats, opts):
380 if exact:
380 if rel in q or abs in q:
381 names.append(abs)
381 names.append(abs)
382 elif repo.dirstate.state(abs) == '?':
382 elif repo.dirstate.state(abs) == '?':
383 ui.status('adding %s\n' % rel)
383 ui.status('adding %s\n' % rel)
@@ -386,15 +386,14 b' def add(ui, repo, *pats, **opts):'
386
386
387 def addremove(ui, repo, *pats, **opts):
387 def addremove(ui, repo, *pats, **opts):
388 """add all new files, delete all missing files"""
388 """add all new files, delete all missing files"""
389 q = dict(zip(pats, pats))
390 add, remove = [], []
389 add, remove = [], []
391 for src, abs, rel in walk(repo, pats, opts):
390 for src, abs, rel, exact in walk(repo, pats, opts):
392 if src == 'f' and repo.dirstate.state(abs) == '?':
391 if src == 'f' and repo.dirstate.state(abs) == '?':
393 add.append(abs)
392 add.append(abs)
394 if rel not in q: ui.status('adding ', rel, '\n')
393 if not exact: ui.status('adding ', rel, '\n')
395 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
394 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
396 remove.append(abs)
395 remove.append(abs)
397 if rel not in q: ui.status('removing ', rel, '\n')
396 if not exact: ui.status('removing ', rel, '\n')
398 repo.add(add)
397 repo.add(add)
399 repo.remove(remove)
398 repo.remove(remove)
400
399
@@ -432,7 +431,7 b' def annotate(ui, repo, *pats, **opts):'
432 node = repo.dirstate.parents()[0]
431 node = repo.dirstate.parents()[0]
433 change = repo.changelog.read(node)
432 change = repo.changelog.read(node)
434 mmap = repo.manifest.read(change[0])
433 mmap = repo.manifest.read(change[0])
435 for src, abs, rel in walk(repo, pats, opts):
434 for src, abs, rel, exact in walk(repo, pats, opts):
436 if abs not in mmap:
435 if abs not in mmap:
437 ui.warn("warning: %s is not in the repository!\n" % rel)
436 ui.warn("warning: %s is not in the repository!\n" % rel)
438 continue
437 continue
@@ -629,8 +628,12 b' def debugindexdot(ui, file_):'
629 def debugwalk(ui, repo, *pats, **opts):
628 def debugwalk(ui, repo, *pats, **opts):
630 items = list(walk(repo, pats, opts))
629 items = list(walk(repo, pats, opts))
631 if not items: return
630 if not items: return
632 fmt = '%%s %%-%ds %%s' % max([len(abs) for (src, abs, rel) in items])
631 fmt = '%%s %%-%ds %%-%ds %%s' % (
633 for i in items: print fmt % i
632 max([len(abs) for (src, abs, rel, exact) in items]),
633 max([len(rel) for (src, abs, rel, exact) in items]))
634 exactly = {True: 'exact', False: ''}
635 for src, abs, rel, exact in items:
636 print fmt % (src, abs, rel, exactly[exact])
634
637
635 def diff(ui, repo, *pats, **opts):
638 def diff(ui, repo, *pats, **opts):
636 """diff working directory (or selected files)"""
639 """diff working directory (or selected files)"""
@@ -645,7 +648,7 b' def diff(ui, repo, *pats, **opts):'
645 match = util.always
648 match = util.always
646 if pats:
649 if pats:
647 roots, match, results = makewalk(repo, pats, opts)
650 roots, match, results = makewalk(repo, pats, opts)
648 for src, abs, rel in results:
651 for src, abs, rel, exact in results:
649 files.append(abs)
652 files.append(abs)
650 dodiff(sys.stdout, ui, repo, files, *revs, **{'match': match})
653 dodiff(sys.stdout, ui, repo, files, *revs, **{'match': match})
651
654
@@ -687,12 +690,11 b' def export(ui, repo, *changesets, **opts'
687
690
688 def forget(ui, repo, *pats, **opts):
691 def forget(ui, repo, *pats, **opts):
689 """don't add the specified files on the next commit"""
692 """don't add the specified files on the next commit"""
690 q = dict(zip(pats, pats))
691 forget = []
693 forget = []
692 for src, abs, rel in walk(repo, pats, opts):
694 for src, abs, rel, exact in walk(repo, pats, opts):
693 if repo.dirstate.state(abs) == 'a':
695 if repo.dirstate.state(abs) == 'a':
694 forget.append(abs)
696 forget.append(abs)
695 if rel not in q: ui.status('forgetting ', rel, '\n')
697 if not exact: ui.status('forgetting ', rel, '\n')
696 repo.forget(forget)
698 repo.forget(forget)
697
699
698 def heads(ui, repo, **opts):
700 def heads(ui, repo, **opts):
@@ -809,7 +811,7 b' def locate(ui, repo, *pats, **opts):'
809 end = '\n'
811 end = '\n'
810 if opts['print0']: end = '\0'
812 if opts['print0']: end = '\0'
811
813
812 for src, abs, rel in walk(repo, pats, opts, '(?:.*/|)'):
814 for src, abs, rel, exact in walk(repo, pats, opts, '(?:.*/|)'):
813 if repo.dirstate.state(abs) == '?': continue
815 if repo.dirstate.state(abs) == '?': continue
814 if opts['fullpath']:
816 if opts['fullpath']:
815 ui.write(os.path.join(repo.root, abs), end)
817 ui.write(os.path.join(repo.root, abs), end)
@@ -1402,6 +1404,7 b" globalopts = [('v', 'verbose', None, 've"
1402 ('', 'debug', None, 'debug mode'),
1404 ('', 'debug', None, 'debug mode'),
1403 ('q', 'quiet', None, 'quiet mode'),
1405 ('q', 'quiet', None, 'quiet mode'),
1404 ('', 'profile', None, 'profile'),
1406 ('', 'profile', None, 'profile'),
1407 ('C', 'cwd', '', 'change working directory'),
1405 ('R', 'repository', "", 'repository root directory'),
1408 ('R', 'repository', "", 'repository root directory'),
1406 ('', 'traceback', None, 'print traceback on exception'),
1409 ('', 'traceback', None, 'print traceback on exception'),
1407 ('y', 'noninteractive', None, 'run non-interactively'),
1410 ('y', 'noninteractive', None, 'run non-interactively'),
@@ -1490,6 +1493,14 b' def dispatch(args):'
1490 help_(u, 'shortlist')
1493 help_(u, 'shortlist')
1491 sys.exit(1)
1494 sys.exit(1)
1492
1495
1496 if options['cwd']:
1497 try:
1498 os.chdir(options['cwd'])
1499 except OSError, inst:
1500 u = ui.ui()
1501 u.warn('abort: %s: %s\n' % (options['cwd'], inst.strerror))
1502 sys.exit(1)
1503
1493 if options["time"]:
1504 if options["time"]:
1494 def get_times():
1505 def get_times():
1495 t = os.times()
1506 t = os.times()
@@ -12,76 +12,76 b' adding mammals/skunk'
12 adding mammals/Procyonidae/cacomistle
12 adding mammals/Procyonidae/cacomistle
13 adding mammals/Procyonidae/coatimundi
13 adding mammals/Procyonidae/coatimundi
14 adding mammals/Procyonidae/raccoon
14 adding mammals/Procyonidae/raccoon
15 f fennel fennel
15 f fennel fennel
16 f fenugreek fenugreek
16 f fenugreek fenugreek
17 f fiddlehead fiddlehead
17 f fiddlehead fiddlehead
18 f glob:glob glob:glob
18 f glob:glob glob:glob
19 f beans/black beans/black
19 f beans/black beans/black
20 f beans/borlotti beans/borlotti
20 f beans/borlotti beans/borlotti
21 f beans/kidney beans/kidney
21 f beans/kidney beans/kidney
22 f beans/navy beans/navy
22 f beans/navy beans/navy
23 f beans/pinto beans/pinto
23 f beans/pinto beans/pinto
24 f beans/turtle beans/turtle
24 f beans/turtle beans/turtle
25 f mammals/skunk mammals/skunk
25 f mammals/skunk mammals/skunk
26 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
26 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
27 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
27 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
28 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
28 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
29 f mammals/skunk skunk
29 f mammals/skunk skunk
30 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
30 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
31 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
31 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
32 f mammals/Procyonidae/raccoon Procyonidae/raccoon
32 f mammals/Procyonidae/raccoon Procyonidae/raccoon
33 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
33 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
34 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
34 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
35 f mammals/Procyonidae/raccoon Procyonidae/raccoon
35 f mammals/Procyonidae/raccoon Procyonidae/raccoon
36 f mammals/Procyonidae/cacomistle cacomistle
36 f mammals/Procyonidae/cacomistle cacomistle
37 f mammals/Procyonidae/coatimundi coatimundi
37 f mammals/Procyonidae/coatimundi coatimundi
38 f mammals/Procyonidae/raccoon raccoon
38 f mammals/Procyonidae/raccoon raccoon
39 f mammals/skunk ../skunk
39 f mammals/skunk ../skunk
40 f mammals/Procyonidae/cacomistle cacomistle
40 f mammals/Procyonidae/cacomistle cacomistle
41 f mammals/Procyonidae/coatimundi coatimundi
41 f mammals/Procyonidae/coatimundi coatimundi
42 f mammals/Procyonidae/raccoon raccoon
42 f mammals/Procyonidae/raccoon raccoon
43 f beans/black ../beans/black
43 f beans/black ../beans/black
44 f beans/borlotti ../beans/borlotti
44 f beans/borlotti ../beans/borlotti
45 f beans/kidney ../beans/kidney
45 f beans/kidney ../beans/kidney
46 f beans/navy ../beans/navy
46 f beans/navy ../beans/navy
47 f beans/pinto ../beans/pinto
47 f beans/pinto ../beans/pinto
48 f beans/turtle ../beans/turtle
48 f beans/turtle ../beans/turtle
49 f mammals/skunk skunk
49 f mammals/skunk skunk
50 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
50 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
51 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
51 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
52 f mammals/Procyonidae/raccoon Procyonidae/raccoon
52 f mammals/Procyonidae/raccoon Procyonidae/raccoon
53 f beans/black beans/black
53 f beans/black beans/black
54 f beans/borlotti beans/borlotti
54 f beans/borlotti beans/borlotti
55 f beans/kidney beans/kidney
55 f beans/kidney beans/kidney
56 f beans/navy beans/navy
56 f beans/navy beans/navy
57 f beans/pinto beans/pinto
57 f beans/pinto beans/pinto
58 f beans/turtle beans/turtle
58 f beans/turtle beans/turtle
59 f beans/black beans/black
59 f beans/black beans/black
60 f beans/borlotti beans/borlotti
60 f beans/borlotti beans/borlotti
61 f mammals/skunk mammals/skunk
61 f mammals/skunk mammals/skunk
62 f mammals/skunk mammals/skunk
62 f mammals/skunk mammals/skunk
63 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
63 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
64 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
64 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
65 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
65 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
66 abort: .. not under repository root
66 abort: .. not under repository root
67 abort: beans/../.. not under repository root
67 abort: beans/../.. not under repository root
68 f fennel fennel
68 f fennel fennel
69 f fenugreek fenugreek
69 f fenugreek fenugreek
70 f fiddlehead fiddlehead
70 f fiddlehead fiddlehead
71 f glob:glob glob:glob
71 f glob:glob glob:glob
72 f fenugreek fenugreek
72 f fenugreek fenugreek
73 f glob:glob glob:glob
73 f glob:glob glob:glob
74 f beans/black beans/black
74 f beans/black beans/black
75 f mammals/skunk mammals/skunk
75 f mammals/skunk mammals/skunk
76 f beans/black beans/black
76 f beans/black beans/black
77 f beans/black beans/black
77 f beans/black beans/black
78 f beans/borlotti beans/borlotti
78 f beans/borlotti beans/borlotti
79 f beans/kidney beans/kidney
79 f beans/kidney beans/kidney
80 f beans/navy beans/navy
80 f beans/navy beans/navy
81 f beans/pinto beans/pinto
81 f beans/pinto beans/pinto
82 f beans/turtle beans/turtle
82 f beans/turtle beans/turtle
83 NOEXIST: No such file or directory
83 NOEXIST: No such file or directory
84 fifo: unsupported file type (type is fifo)
84 fifo: unsupported file type (type is fifo)
85 m fenugreek fenugreek
85 m fenugreek fenugreek exact
86 m fenugreek fenugreek
86 m fenugreek fenugreek exact
87 f new new
87 f new new exact
General Comments 0
You need to be logged in to leave comments. Login now