##// END OF EJS Templates
Merge with BOS
mpm@selenic.com -
r814:0902ffec merge default
parent child Browse files
Show More
@@ -73,8 +73,8 b' annotate [-r <rev> -u -n -c] [files ...]'
73 73 place.
74 74
75 75 options:
76 -I, --include <pat> include directories matching the given patterns
77 -X, --exclude <pat> exclude directories matching the given patterns
76 -I, --include <pat> include names matching the given patterns
77 -X, --exclude <pat> exclude names matching the given patterns
78 78 -r, --revision <rev> annotate the specified revision
79 79 -u, --user list the author
80 80 -c, --changeset list the changeset
@@ -100,11 +100,11 b' clone [-U] <source> [dest]::'
100 100 options:
101 101 -U, --noupdate do not update the new working directory
102 102
103 commit [-A -t -l <file> -m <text> -u <user> -d <datecode>] [files...]::
103 commit [options] [files...]::
104 104 Commit changes to the given files into the repository.
105 105
106 106 If a list of files is omitted, all changes reported by "hg status"
107 will be commited.
107 from the root of the repository will be commited.
108 108
109 109 The HGEDITOR or EDITOR environment variables are used to start an
110 110 editor to add a commit comment.
@@ -112,6 +112,8 b' commit [-A -t -l <file> -m <text> -u <us'
112 112 Options:
113 113
114 114 -A, --addremove run addremove during commit
115 -I, --include <pat> include names matching the given patterns
116 -X, --exclude <pat> exclude names matching the given patterns
115 117 -m, --message <text> use <text> as commit message
116 118 -l, --logfile <file> show the commit message for the given file
117 119 -d, --date <datecode> record datecode as commit date
@@ -136,8 +138,8 b' diff [-r revision] [-r revision] [files '
136 138 to its parent.
137 139
138 140 options:
139 -I, --include <pat> include directories matching the given patterns
140 -X, --exclude <pat> exclude directories matching the given patterns
141 -I, --include <pat> include names matching the given patterns
142 -X, --exclude <pat> exclude names matching the given patterns
141 143
142 144 export [-o filespec] [revision] ...::
143 145 Print the changeset header and diffs for one or more revisions.
@@ -161,9 +163,13 b' export [-o filespec] [revision] ...::'
161 163
162 164 -o, --output <filespec> print output to file with formatted named
163 165
164 forget [files]::
166 forget [options] [files]::
165 167 Undo an 'hg add' scheduled for the next commit.
166 168
169 options:
170 -I, --include <pat> include names matching the given patterns
171 -X, --exclude <pat> exclude names matching the given patterns
172
167 173 heads::
168 174 Show all repository head changesets.
169 175
@@ -213,9 +219,9 b' locate [options] [files]::'
213 219
214 220 -0, --print0 end filenames with NUL, for use with xargs
215 221 -f, --fullpath print complete paths from the filesystem root
216 -I, --include <pat> include directories matching the given patterns
222 -I, --include <pat> include names matching the given patterns
217 223 -r, --rev <rev> search the repository as it stood at rev
218 -X, --exclude <pat> exclude directories matching the given patterns
224 -X, --exclude <pat> exclude names matching the given patterns
219 225
220 226 log [-r revision ...] [-p] [file]::
221 227 Print the revision history of the specified file or the entire project.
@@ -339,8 +345,8 b' status [options] [files]::'
339 345
340 346 options:
341 347
342 -I, --include <pat> include directories matching the given patterns
343 -X, --exclude <pat> exclude directories matching the given patterns
348 -I, --include <pat> include names matching the given patterns
349 -X, --exclude <pat> exclude names matching the given patterns
344 350
345 351 tag [-l -m <text> -d <datecode> -u <user>] <name> [revision]::
346 352 Name a particular revision using <name>.
@@ -47,7 +47,8 b" def walk(repo, pats, opts, head = ''):"
47 47 cwd = repo.getcwd()
48 48 c = 0
49 49 if cwd: c = len(cwd) + 1
50 for src, fn in repo.walk(match = matchpats(cwd, pats, opts, head)):
50 files, matchfn = matchpats(cwd, pats, opts, head)
51 for src, fn in repo.walk(files = files, match = matchfn):
51 52 yield src, fn, fn[c:]
52 53
53 54 revrangesep = ':'
@@ -339,17 +340,17 b' def add(ui, repo, *pats, **opts):'
339 340 def addremove(ui, repo, *pats, **opts):
340 341 """add all new files, delete all missing files"""
341 342 q = dict(zip(pats, pats))
342 cwd = repo.getcwd()
343 n = (cwd and len(cwd) + 1) or 0
344 c, a, d, u = repo.changes(match = matchpats(cwd, pats, opts))
345 for f in u:
346 if f not in q:
347 ui.status('adding %s\n' % f[n:])
348 repo.add(u)
349 for f in d:
350 if f not in q:
351 ui.status('removing %s\n' % f[n:])
352 repo.remove(d)
343 add, remove = [], []
344 for src, abs, rel in walk(repo, pats, opts):
345 if src == 'f':
346 if repo.dirstate.state(abs) == '?':
347 add.append(abs)
348 if rel not in q: ui.status('adding ', rel, '\n')
349 elif repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
350 remove.append(abs)
351 if rel not in q: ui.status('removing ', rel, '\n')
352 repo.add(add)
353 repo.remove(remove)
353 354
354 355 def annotate(ui, repo, *pats, **opts):
355 356 """show changeset information per file line"""
@@ -467,7 +468,7 b' def clone(ui, source, dest=None, **opts)'
467 468
468 469 d.close()
469 470
470 def commit(ui, repo, *files, **opts):
471 def commit(ui, repo, *pats, **opts):
471 472 """commit the specified files or all outstanding changes"""
472 473 if opts['text']:
473 474 ui.warn("Warning: -t and --text is deprecated,"
@@ -481,8 +482,18 b' def commit(ui, repo, *files, **opts):'
481 482 ui.warn("Can't read commit message %s: %s\n" % (logfile, why))
482 483
483 484 if opts['addremove']:
484 addremove(ui, repo, *files)
485 repo.commit(relpath(repo, files), message, opts['user'], opts['date'])
485 addremove(ui, repo, *pats, **opts)
486 cwd = repo.getcwd()
487 if not pats and cwd:
488 opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
489 opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
490 fns, match = matchpats((pats and repo.getcwd()) or '', pats, opts)
491 if pats:
492 c, a, d, u = repo.changes(files = fns, match = match)
493 files = c + a + [fn for fn in d if repo.dirstate.state(fn) == 'r']
494 else:
495 files = []
496 repo.commit(files, message, opts['user'], opts['date'], match)
486 497
487 498 def copy(ui, repo, source, dest):
488 499 """mark a file as copied or renamed for the next commit"""
@@ -604,9 +615,15 b' def export(ui, repo, *changesets, **opts'
604 615 seqno += 1
605 616 doexport(ui, repo, cset, seqno, total, revwidth, opts)
606 617
607 def forget(ui, repo, file1, *files):
618 def forget(ui, repo, *pats, **opts):
608 619 """don't add the specified files on the next commit"""
609 repo.forget(relpath(repo, (file1,) + files))
620 q = dict(zip(pats, pats))
621 forget = []
622 for src, abs, rel in walk(repo, pats, opts):
623 if repo.dirstate.state(abs) == 'a':
624 forget.append(abs)
625 if rel not in q: ui.status('forgetting ', rel, '\n')
626 repo.forget(forget)
610 627
611 628 def heads(ui, repo):
612 629 """show current repository heads"""
@@ -1004,7 +1021,8 b' def status(ui, repo, *pats, **opts):'
1004 1021 R = removed
1005 1022 ? = not tracked'''
1006 1023
1007 (c, a, d, u) = repo.changes(match = matchpats(repo.getcwd(), pats, opts))
1024 files, matchfn = matchpats(repo.getcwd(), pats, opts)
1025 (c, a, d, u) = repo.changes(files = files, match = matchfn)
1008 1026 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
1009 1027
1010 1028 for f in c:
@@ -1135,6 +1153,8 b' table = {'
1135 1153 "^commit|ci":
1136 1154 (commit,
1137 1155 [('A', 'addremove', None, 'run add/remove during commit'),
1156 ('I', 'include', [], 'include path in search'),
1157 ('X', 'exclude', [], 'exclude path from search'),
1138 1158 ('m', 'message', "", 'commit message'),
1139 1159 ('t', 'text', "", 'commit message (deprecated: use -m)'),
1140 1160 ('l', 'logfile', "", 'commit message file'),
@@ -1156,7 +1176,10 b' table = {'
1156 1176 (export,
1157 1177 [('o', 'output', "", 'output to file')],
1158 1178 "hg export [-o OUTFILE] REV..."),
1159 "forget": (forget, [], "hg forget FILE..."),
1179 "forget": (forget,
1180 [('I', 'include', [], 'include path in search'),
1181 ('X', 'exclude', [], 'exclude path from search')],
1182 "hg forget FILE..."),
1160 1183 "heads": (heads, [], 'hg heads'),
1161 1184 "help": (help_, [], 'hg help [COMMAND]'),
1162 1185 "identify|id": (identify, [], 'hg identify'),
@@ -773,7 +773,8 b' class localrepository:'
773 773 if update_dirstate:
774 774 self.dirstate.setparents(n, nullid)
775 775
776 def commit(self, files = None, text = "", user = None, date = None):
776 def commit(self, files = None, text = "", user = None, date = None,
777 match = util.always):
777 778 commit = []
778 779 remove = []
779 780 if files:
@@ -786,7 +787,7 b' class localrepository:'
786 787 else:
787 788 self.ui.warn("%s not tracked!\n" % f)
788 789 else:
789 (c, a, d, u) = self.changes()
790 (c, a, d, u) = self.changes(match = match)
790 791 commit = c + a
791 792 remove = d
792 793
@@ -66,7 +66,15 b" def globre(pat, head = '^', tail = '$'):"
66 66 res += re.escape(c)
67 67 return head + res + tail
68 68
69 def matcher(cwd, pats, inc, exc, head = ''):
69 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1}
70
71 def matcher(cwd, names, inc, exc, head = ''):
72 def patlike(name):
73 for prefix in 're:', 'glob:', 'path:':
74 if name.startswith(prefix): return True
75 for c in name:
76 if c in _globchars: return True
77
70 78 def regex(name, tail):
71 79 '''convert a pattern into a regular expression'''
72 80 if name.startswith('re:'):
@@ -77,6 +85,8 b' def matcher(cwd, pats, inc, exc, head = '
77 85 return head + globre(name[5:], '', tail)
78 86 return head + globre(name, '', tail)
79 87
88 cwdsep = cwd + os.sep
89
80 90 def under(fn):
81 91 """check if fn is under our cwd"""
82 92 return not cwd or fn.startswith(cwdsep)
@@ -86,16 +96,25 b' def matcher(cwd, pats, inc, exc, head = '
86 96 if pats:
87 97 pat = '(?:%s)' % '|'.join([regex(p, tail) for p in pats])
88 98 if cwd:
89 pat = re.escape(cwd + os.sep) + pat
99 pat = re.escape(cwdsep) + pat
90 100 return re.compile(pat).match
91 101
92 cwdsep = cwd + os.sep
93 patmatch = matchfn(pats, '$') or (lambda fn: True)
102 pats = filter(patlike, names)
103 files = [n for n in names if not patlike(n)]
104 if pats: plain = []
105 elif cwd: plain = [cwdsep + f for f in files]
106 else: plain = files
107
108 patmatch = matchfn(pats, '$')
109 filematch = matchfn(files, '(?:/|$)')
94 110 incmatch = matchfn(inc, '(?:/|$)') or under
95 111 excmatch = matchfn(exc, '(?:/|$)') or (lambda fn: False)
96 112
97 return lambda fn: (incmatch(fn) and not excmatch(fn) and
98 (fn.endswith('/') or patmatch(fn)))
113 return plain, lambda fn: (incmatch(fn) and not excmatch(fn) and
114 (fn.endswith('/') or
115 (not pats and not files) or
116 (pats and patmatch(fn)) or
117 (files and filematch(fn))))
99 118
100 119 def system(cmd, errprefix=None):
101 120 """execute a shell command that must succeed"""
General Comments 0
You need to be logged in to leave comments. Login now