##// END OF EJS Templates
Adapt commit to use file matching code....
Bryan O'Sullivan -
r813:80fd2958 default
parent child Browse files
Show More
@@ -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
@@ -468,7 +468,7 b' def clone(ui, source, dest=None, **opts)'
468
468
469 d.close()
469 d.close()
470
470
471 def commit(ui, repo, *files, **opts):
471 def commit(ui, repo, *pats, **opts):
472 """commit the specified files or all outstanding changes"""
472 """commit the specified files or all outstanding changes"""
473 if opts['text']:
473 if opts['text']:
474 ui.warn("Warning: -t and --text is deprecated,"
474 ui.warn("Warning: -t and --text is deprecated,"
@@ -482,8 +482,18 b' def commit(ui, repo, *files, **opts):'
482 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))
483
483
484 if opts['addremove']:
484 if opts['addremove']:
485 addremove(ui, repo, *files)
485 addremove(ui, repo, *pats, **opts)
486 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)
487
497
488 def copy(ui, repo, source, dest):
498 def copy(ui, repo, source, dest):
489 """mark a file as copied or renamed for the next commit"""
499 """mark a file as copied or renamed for the next commit"""
@@ -1140,6 +1150,8 b' table = {'
1140 "^commit|ci":
1150 "^commit|ci":
1141 (commit,
1151 (commit,
1142 [('A', 'addremove', None, 'run add/remove during commit'),
1152 [('A', 'addremove', None, 'run add/remove during commit'),
1153 ('I', 'include', [], 'include path in search'),
1154 ('X', 'exclude', [], 'exclude path from search'),
1143 ('m', 'message', "", 'commit message'),
1155 ('m', 'message', "", 'commit message'),
1144 ('t', 'text', "", 'commit message (deprecated: use -m)'),
1156 ('t', 'text', "", 'commit message (deprecated: use -m)'),
1145 ('l', 'logfile', "", 'commit message file'),
1157 ('l', 'logfile', "", 'commit message file'),
@@ -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
General Comments 0
You need to be logged in to leave comments. Login now