##// END OF EJS Templates
make all commands be repo-wide by default...
Benoit Boissinot -
r1568:1d7d0c07 default
parent child Browse files
Show More
@@ -33,13 +33,17 b' def relpath(repo, args):'
33 33 return [util.normpath(os.path.join(cwd, x)) for x in args]
34 34 return args
35 35
36 def matchpats(repo, cwd, pats=[], opts={}, head=''):
36 def matchpats(repo, pats=[], opts={}, head=''):
37 cwd = repo.getcwd()
38 if not pats and cwd:
39 opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
40 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
41 cwd = ''
37 42 return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
38 opts.get('exclude'), head)
43 opts.get('exclude'), head) + (cwd,)
39 44
40 45 def makewalk(repo, pats, opts, head=''):
41 cwd = repo.getcwd()
42 files, matchfn, anypats = matchpats(repo, cwd, pats, opts, head)
46 files, matchfn, anypats, cwd = matchpats(repo, pats, opts, head)
43 47 exact = dict(zip(files, files))
44 48 def walk():
45 49 for src, fn in repo.walk(files=files, match=matchfn):
@@ -51,7 +55,7 b" def walk(repo, pats, opts, head=''):"
51 55 for r in results:
52 56 yield r
53 57
54 def walkchangerevs(ui, repo, cwd, pats, opts):
58 def walkchangerevs(ui, repo, pats, opts):
55 59 '''Iterate over files and the revs they changed in.
56 60
57 61 Callers most commonly need to iterate backwards over the history
@@ -81,12 +85,7 b' def walkchangerevs(ui, repo, cwd, pats, '
81 85 if repo.changelog.count() == 0:
82 86 return [], False
83 87
84 cwd = repo.getcwd()
85 if not pats and cwd:
86 opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
87 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
88 files, matchfn, anypats = matchpats(repo, (pats and cwd) or '',
89 pats, opts)
88 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
90 89 revs = map(int, revrange(ui, repo, opts['rev'] or ['tip:0']))
91 90 wanted = {}
92 91 slowpath = anypats
@@ -483,8 +482,7 b' def add(ui, repo, *pats, **opts):'
483 482
484 483 The files will be added to the repository at the next commit.
485 484
486 If no names are given, add all files in the current directory and
487 its subdirectories.
485 If no names are given, add all files in the repository.
488 486 """
489 487
490 488 names = []
@@ -759,7 +757,7 b' def commit(ui, repo, *pats, **opts):'
759 757 Commit changes to the given files into the repository.
760 758
761 759 If a list of files is omitted, all changes reported by "hg status"
762 from the root of the repository will be commited.
760 will be commited.
763 761
764 762 The HGEDITOR or EDITOR environment variables are used to start an
765 763 editor to add a commit comment.
@@ -782,12 +780,7 b' def commit(ui, repo, *pats, **opts):'
782 780
783 781 if opts['addremove']:
784 782 addremove(ui, repo, *pats, **opts)
785 cwd = repo.getcwd()
786 if not pats and cwd:
787 opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
788 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
789 fns, match, anypats = matchpats(repo, (pats and repo.getcwd()) or '',
790 pats, opts)
783 fns, match, anypats, cwd = matchpats(repo, pats, opts)
791 784 if pats:
792 785 c, a, d, u = repo.changes(files=fns, match=match)
793 786 files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
@@ -1097,7 +1090,7 b' def debugwalk(ui, repo, *pats, **opts):'
1097 1090 ui.write("%s\n" % line.rstrip())
1098 1091
1099 1092 def diff(ui, repo, *pats, **opts):
1100 """diff working directory (or selected files)
1093 """diff repository (or selected files)
1101 1094
1102 1095 Show differences between revisions for the specified files.
1103 1096
@@ -1123,7 +1116,7 b' def diff(ui, repo, *pats, **opts):'
1123 1116 if len(revs) > 2:
1124 1117 raise util.Abort(_("too many revisions to diff"))
1125 1118
1126 fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
1119 fns, matchfn, anypats, cwd = matchpats(repo, pats, opts)
1127 1120
1128 1121 dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn,
1129 1122 text=opts['text'])
@@ -1294,7 +1287,7 b' def grep(ui, repo, pattern, *pats, **opt'
1294 1287
1295 1288 fstate = {}
1296 1289 skip = {}
1297 changeiter, getchange = walkchangerevs(ui, repo, repo.getcwd(), pats, opts)
1290 changeiter, getchange = walkchangerevs(ui, repo, pats, opts)
1298 1291 count = 0
1299 1292 incrementing = False
1300 1293 for st, rev, fns in changeiter:
@@ -1557,12 +1550,7 b' def log(ui, repo, *pats, **opts):'
1557 1550 self.write(*args)
1558 1551 def __getattr__(self, key):
1559 1552 return getattr(self.ui, key)
1560 cwd = repo.getcwd()
1561 if not pats and cwd:
1562 opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
1563 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
1564 changeiter, getchange = walkchangerevs(ui, repo, (pats and cwd) or '',
1565 pats, opts)
1553 changeiter, getchange = walkchangerevs(ui, repo, pats, opts)
1566 1554 for st, rev, fns in changeiter:
1567 1555 if st == 'window':
1568 1556 du = dui(ui)
@@ -1871,13 +1859,12 b' def revert(ui, repo, *pats, **opts):'
1871 1859
1872 1860 If names are given, all files matching the names are reverted.
1873 1861
1874 If no names are given, all files in the current directory and
1875 its subdirectories are reverted.
1862 If no arguments are given, all files in the repository are reverted.
1876 1863 """
1877 1864 node = opts['rev'] and repo.lookup(opts['rev']) or \
1878 1865 repo.dirstate.parents()[0]
1879 1866
1880 files, choose, anypats = matchpats(repo, repo.getcwd(), pats, opts)
1867 files, choose, anypats, cwd = matchpats(repo, pats, opts)
1881 1868 (c, a, d, u) = repo.changes(match=choose)
1882 1869 repo.forget(a)
1883 1870 repo.undelete(d)
@@ -2000,9 +1987,8 b' def serve(ui, repo, **opts):'
2000 1987 def status(ui, repo, *pats, **opts):
2001 1988 """show changed files in the working directory
2002 1989
2003 Show changed files in the working directory. If no names are
2004 given, all files are shown. Otherwise, only files matching the
2005 given names are shown.
1990 Show changed files in the repository. If names are
1991 given, only files that match are shown.
2006 1992
2007 1993 The codes used to show the status of files are:
2008 1994 M = modified
@@ -2011,8 +1997,7 b' def status(ui, repo, *pats, **opts):'
2011 1997 ? = not tracked
2012 1998 """
2013 1999
2014 cwd = repo.getcwd()
2015 files, matchfn, anypats = matchpats(repo, cwd, pats, opts)
2000 files, matchfn, anypats, cwd = matchpats(repo, pats, opts)
2016 2001 (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
2017 2002 for n in repo.changes(files=files, match=matchfn)]
2018 2003
@@ -6,7 +6,7 b' basic commands (use "hg help" for the fu'
6 6 annotate show changeset information per file line
7 7 clone make a copy of an existing repository
8 8 commit commit the specified files or all outstanding changes
9 diff diff working directory (or selected files)
9 diff diff repository (or selected files)
10 10 export dump the header and diffs for one or more changesets
11 11 init create a new repository in the given directory
12 12 log show revision history of entire repository or files
@@ -22,7 +22,7 b' basic commands (use "hg help" for the fu'
22 22 annotate show changeset information per file line
23 23 clone make a copy of an existing repository
24 24 commit commit the specified files or all outstanding changes
25 diff diff working directory (or selected files)
25 diff diff repository (or selected files)
26 26 export dump the header and diffs for one or more changesets
27 27 init create a new repository in the given directory
28 28 log show revision history of entire repository or files
@@ -46,7 +46,7 b' list of commands (use "hg help -v" to sh'
46 46 clone make a copy of an existing repository
47 47 commit commit the specified files or all outstanding changes
48 48 copy mark files as copied for the next commit
49 diff diff working directory (or selected files)
49 diff diff repository (or selected files)
50 50 export dump the header and diffs for one or more changesets
51 51 forget don't add the specified files on the next commit
52 52 grep search for a pattern in specified files and revisions
@@ -88,7 +88,7 b' list of commands (use "hg help -v" to sh'
88 88 clone make a copy of an existing repository
89 89 commit commit the specified files or all outstanding changes
90 90 copy mark files as copied for the next commit
91 diff diff working directory (or selected files)
91 diff diff repository (or selected files)
92 92 export dump the header and diffs for one or more changesets
93 93 forget don't add the specified files on the next commit
94 94 grep search for a pattern in specified files and revisions
@@ -130,8 +130,7 b' add the specified files on the next comm'
130 130
131 131 The files will be added to the repository at the next commit.
132 132
133 If no names are given, add all files in the current directory and
134 its subdirectories.
133 If no names are given, add all files in the repository.
135 134
136 135 options:
137 136
@@ -146,8 +145,7 b' add the specified files on the next comm'
146 145
147 146 The files will be added to the repository at the next commit.
148 147
149 If no names are given, add all files in the current directory and
150 its subdirectories.
148 If no names are given, add all files in the repository.
151 149
152 150 options:
153 151
@@ -155,7 +153,7 b' options:'
155 153 -X --exclude exclude names matching the given patterns
156 154 hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...
157 155
158 diff working directory (or selected files)
156 diff repository (or selected files)
159 157
160 158 Show differences between revisions for the specified files.
161 159
@@ -181,9 +179,8 b' hg status [OPTION]... [FILE]...'
181 179
182 180 show changed files in the working directory
183 181
184 Show changed files in the working directory. If no names are
185 given, all files are shown. Otherwise, only files matching the
186 given names are shown.
182 Show changed files in the repository. If names are
183 given, only files that match are shown.
187 184
188 185 The codes used to show the status of files are:
189 186 M = modified
@@ -215,7 +212,7 b' basic commands (use "hg help" for the fu'
215 212 annotate show changeset information per file line
216 213 clone make a copy of an existing repository
217 214 commit commit the specified files or all outstanding changes
218 diff diff working directory (or selected files)
215 diff diff repository (or selected files)
219 216 export dump the header and diffs for one or more changesets
220 217 init create a new repository in the given directory
221 218 log show revision history of entire repository or files
@@ -236,7 +233,7 b' basic commands (use "hg help" for the fu'
236 233 annotate show changeset information per file line
237 234 clone make a copy of an existing repository
238 235 commit commit the specified files or all outstanding changes
239 diff diff working directory (or selected files)
236 diff diff repository (or selected files)
240 237 export dump the header and diffs for one or more changesets
241 238 init create a new repository in the given directory
242 239 log show revision history of entire repository or files
@@ -42,4 +42,4 b' echo "relglob:*" > .hgignore'
42 42 echo "--" ; hg status
43 43
44 44 cd dir
45 echo "--" ; hg status
45 echo "--" ; hg status .
@@ -20,14 +20,14 b' hg addremove'
20 20 hg commit -m "commit #0" -d "0 0"
21 21 hg debugwalk
22 22 cd mammals
23 hg debugwalk
23 hg debugwalk .
24 24 hg debugwalk Procyonidae
25 25 cd Procyonidae
26 hg debugwalk
26 hg debugwalk .
27 27 hg debugwalk ..
28 28 cd ..
29 29 hg debugwalk ../beans
30 hg debugwalk
30 hg debugwalk .
31 31 cd ..
32 32 hg debugwalk -Ibeans
33 33 hg debugwalk 'glob:mammals/../beans/b*'
General Comments 0
You need to be logged in to leave comments. Login now