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