##// END OF EJS Templates
Add a forget command for easily untracking files....
Steve Losh -
r8902:b9a8b616 default
parent child Browse files
Show More
@@ -24,7 +24,7 b' def add(ui, repo, *pats, **opts):'
24 repository.
24 repository.
25
25
26 The files will be added to the repository at the next commit. To
26 The files will be added to the repository at the next commit. To
27 undo an add before that, see hg revert.
27 undo an add before that, see hg forget.
28
28
29 If no names are given, add all files to the repository.
29 If no names are given, add all files to the repository.
30 """
30 """
@@ -1138,6 +1138,37 b' def export(ui, repo, *changesets, **opts'
1138 switch_parent=opts.get('switch_parent'),
1138 switch_parent=opts.get('switch_parent'),
1139 opts=patch.diffopts(ui, opts))
1139 opts=patch.diffopts(ui, opts))
1140
1140
1141 def forget(ui, repo, *pats, **opts):
1142 """forget the specified files on the next commit
1143
1144 Mark the specified files so they will no longer be tracked
1145 after the next commit.
1146
1147 This only removes files from the current branch, not from the
1148 entire project history, and it does not delete them from the
1149 working directory.
1150
1151 To undo a forget before the next commit, see hg add.
1152 """
1153
1154 if not pats:
1155 raise util.Abort(_('no files specified'))
1156
1157 m = cmdutil.match(repo, pats, opts)
1158 s = repo.status(match=m, clean=True)
1159 forget = sorted(s[0] + s[1] + s[3] + s[6])
1160
1161 for f in m.files():
1162 if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
1163 ui.warn(_('not removing %s: file is already untracked\n')
1164 % m.rel(f))
1165
1166 for f in forget:
1167 if ui.verbose or not m.exact(f):
1168 ui.status(_('removing %s\n') % m.rel(f))
1169
1170 repo.remove(forget, unlink=False)
1171
1141 def grep(ui, repo, pattern, *pats, **opts):
1172 def grep(ui, repo, pattern, *pats, **opts):
1142 """search for a pattern in specified files and revisions
1173 """search for a pattern in specified files and revisions
1143
1174
@@ -3269,6 +3300,10 b' table = {'
3269 ('', 'switch-parent', None, _('diff against the second parent'))
3300 ('', 'switch-parent', None, _('diff against the second parent'))
3270 ] + diffopts,
3301 ] + diffopts,
3271 _('[OPTION]... [-o OUTFILESPEC] REV...')),
3302 _('[OPTION]... [-o OUTFILESPEC] REV...')),
3303 "^forget":
3304 (forget,
3305 [] + walkopts,
3306 _('[OPTION]... FILE...')),
3272 "grep":
3307 "grep":
3273 (grep,
3308 (grep,
3274 [('0', 'print0', None, _('end fields with NUL')),
3309 [('0', 'print0', None, _('end fields with NUL')),
@@ -7,6 +7,9 b' hg add -n'
7 hg st
7 hg st
8 hg add
8 hg add
9 hg st
9 hg st
10 hg forget a
11 hg add
12 hg st
10
13
11 echo b > b
14 echo b > b
12 hg add -n b
15 hg add -n b
@@ -36,6 +39,9 b' hg resolve -m a'
36 hg ci -m merge
39 hg ci -m merge
37
40
38 echo % issue683
41 echo % issue683
42 hg forget a
43 hg add a
44 hg st
39 hg rm a
45 hg rm a
40 hg st
46 hg st
41 echo a > a
47 echo a > a
@@ -2,6 +2,8 b' adding a'
2 ? a
2 ? a
3 adding a
3 adding a
4 A a
4 A a
5 adding a
6 A a
5 A a
7 A a
6 ? b
8 ? b
7 A a
9 A a
@@ -26,6 +28,7 b' a already tracked!'
26 M a
28 M a
27 ? a.orig
29 ? a.orig
28 % issue683
30 % issue683
31 ? a.orig
29 R a
32 R a
30 ? a.orig
33 ? a.orig
31 M a
34 M a
@@ -14,6 +14,7 b' commit'
14 copy
14 copy
15 diff
15 diff
16 export
16 export
17 forget
17 grep
18 grep
18 heads
19 heads
19 help
20 help
@@ -167,6 +168,7 b' clone: noupdate, rev, pull, uncompressed'
167 commit: addremove, close-branch, include, exclude, message, logfile, date, user
168 commit: addremove, close-branch, include, exclude, message, logfile, date, user
168 diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, include, exclude
169 diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, include, exclude
169 export: output, switch-parent, text, git, nodates
170 export: output, switch-parent, text, git, nodates
171 forget: include, exclude
170 init: ssh, remotecmd
172 init: ssh, remotecmd
171 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, prune, patch, git, limit, no-merges, style, template, include, exclude
173 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, prune, patch, git, limit, no-merges, style, template, include, exclude
172 merge: force, rev, preview
174 merge: force, rev, preview
@@ -164,6 +164,7 b' list of commands:'
164 copy mark files as copied for the next commit
164 copy mark files as copied for the next commit
165 diff diff repository (or selected files)
165 diff diff repository (or selected files)
166 export dump the header and diffs for one or more changesets
166 export dump the header and diffs for one or more changesets
167 forget forget the specified files on the next commit
167 grep search for a pattern in specified files and revisions
168 grep search for a pattern in specified files and revisions
168 heads show current repository heads or show branch heads
169 heads show current repository heads or show branch heads
169 help show help for a given topic or a help overview
170 help show help for a given topic or a help overview
@@ -230,6 +231,7 b' list of commands:'
230 copy mark files as copied for the next commit
231 copy mark files as copied for the next commit
231 diff diff repository (or selected files)
232 diff diff repository (or selected files)
232 export dump the header and diffs for one or more changesets
233 export dump the header and diffs for one or more changesets
234 forget forget the specified files on the next commit
233 grep search for a pattern in specified files and revisions
235 grep search for a pattern in specified files and revisions
234 heads show current repository heads or show branch heads
236 heads show current repository heads or show branch heads
235 help show help for a given topic or a help overview
237 help show help for a given topic or a help overview
@@ -8,6 +8,7 b' basic commands:'
8 commit commit the specified files or all outstanding changes
8 commit commit the specified files or all outstanding changes
9 diff diff repository (or selected files)
9 diff diff repository (or selected files)
10 export dump the header and diffs for one or more changesets
10 export dump the header and diffs for one or more changesets
11 forget forget the specified files on the next commit
11 init create a new repository in the given directory
12 init create a new repository in the given directory
12 log show revision history of entire repository or files
13 log show revision history of entire repository or files
13 merge merge working directory with another revision
14 merge merge working directory with another revision
@@ -26,6 +27,7 b' use "hg help" for the full list of comma'
26 commit commit the specified files or all outstanding changes
27 commit commit the specified files or all outstanding changes
27 diff diff repository (or selected files)
28 diff diff repository (or selected files)
28 export dump the header and diffs for one or more changesets
29 export dump the header and diffs for one or more changesets
30 forget forget the specified files on the next commit
29 init create a new repository in the given directory
31 init create a new repository in the given directory
30 log show revision history of entire repository or files
32 log show revision history of entire repository or files
31 merge merge working directory with another revision
33 merge merge working directory with another revision
@@ -55,6 +57,7 b' list of commands:'
55 copy mark files as copied for the next commit
57 copy mark files as copied for the next commit
56 diff diff repository (or selected files)
58 diff diff repository (or selected files)
57 export dump the header and diffs for one or more changesets
59 export dump the header and diffs for one or more changesets
60 forget forget the specified files on the next commit
58 grep search for a pattern in specified files and revisions
61 grep search for a pattern in specified files and revisions
59 heads show current repository heads or show branch heads
62 heads show current repository heads or show branch heads
60 help show help for a given topic or a help overview
63 help show help for a given topic or a help overview
@@ -117,6 +120,7 b' use "hg -v help" to show aliases and glo'
117 copy mark files as copied for the next commit
120 copy mark files as copied for the next commit
118 diff diff repository (or selected files)
121 diff diff repository (or selected files)
119 export dump the header and diffs for one or more changesets
122 export dump the header and diffs for one or more changesets
123 forget forget the specified files on the next commit
120 grep search for a pattern in specified files and revisions
124 grep search for a pattern in specified files and revisions
121 heads show current repository heads or show branch heads
125 heads show current repository heads or show branch heads
122 help show help for a given topic or a help overview
126 help show help for a given topic or a help overview
@@ -170,7 +174,7 b' add the specified files on the next comm'
170 repository.
174 repository.
171
175
172 The files will be added to the repository at the next commit. To
176 The files will be added to the repository at the next commit. To
173 undo an add before that, see hg revert.
177 undo an add before that, see hg forget.
174
178
175 If no names are given, add all files to the repository.
179 If no names are given, add all files to the repository.
176
180
@@ -190,7 +194,7 b' add the specified files on the next comm'
190 repository.
194 repository.
191
195
192 The files will be added to the repository at the next commit. To
196 The files will be added to the repository at the next commit. To
193 undo an add before that, see hg revert.
197 undo an add before that, see hg forget.
194
198
195 If no names are given, add all files to the repository.
199 If no names are given, add all files to the repository.
196
200
@@ -309,6 +313,7 b' basic commands:'
309 commit commit the specified files or all outstanding changes
313 commit commit the specified files or all outstanding changes
310 diff diff repository (or selected files)
314 diff diff repository (or selected files)
311 export dump the header and diffs for one or more changesets
315 export dump the header and diffs for one or more changesets
316 forget forget the specified files on the next commit
312 init create a new repository in the given directory
317 init create a new repository in the given directory
313 log show revision history of entire repository or files
318 log show revision history of entire repository or files
314 merge merge working directory with another revision
319 merge merge working directory with another revision
@@ -332,6 +337,7 b' basic commands:'
332 commit commit the specified files or all outstanding changes
337 commit commit the specified files or all outstanding changes
333 diff diff repository (or selected files)
338 diff diff repository (or selected files)
334 export dump the header and diffs for one or more changesets
339 export dump the header and diffs for one or more changesets
340 forget forget the specified files on the next commit
335 init create a new repository in the given directory
341 init create a new repository in the given directory
336 log show revision history of entire repository or files
342 log show revision history of entire repository or files
337 merge merge working directory with another revision
343 merge merge working directory with another revision
@@ -10,6 +10,7 b' basic commands:'
10 commit commit the specified files or all outstanding changes
10 commit commit the specified files or all outstanding changes
11 diff diff repository (or selected files)
11 diff diff repository (or selected files)
12 export dump the header and diffs for one or more changesets
12 export dump the header and diffs for one or more changesets
13 forget forget the specified files on the next commit
13 init create a new repository in the given directory
14 init create a new repository in the given directory
14 log show revision history of entire repository or files
15 log show revision history of entire repository or files
15 merge merge working directory with another revision
16 merge merge working directory with another revision
@@ -11,6 +11,7 b' basic commands:'
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 init create a new repository in the given directory
15 init create a new repository in the given directory
15 log show revision history of entire repository or files
16 log show revision history of entire repository or files
16 merge merge working directory with another revision
17 merge merge working directory with another revision
General Comments 0
You need to be logged in to leave comments. Login now