##// 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 24 repository.
25 25
26 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 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 1138 switch_parent=opts.get('switch_parent'),
1139 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 1172 def grep(ui, repo, pattern, *pats, **opts):
1142 1173 """search for a pattern in specified files and revisions
1143 1174
@@ -3269,6 +3300,10 b' table = {'
3269 3300 ('', 'switch-parent', None, _('diff against the second parent'))
3270 3301 ] + diffopts,
3271 3302 _('[OPTION]... [-o OUTFILESPEC] REV...')),
3303 "^forget":
3304 (forget,
3305 [] + walkopts,
3306 _('[OPTION]... FILE...')),
3272 3307 "grep":
3273 3308 (grep,
3274 3309 [('0', 'print0', None, _('end fields with NUL')),
@@ -7,6 +7,9 b' hg add -n'
7 7 hg st
8 8 hg add
9 9 hg st
10 hg forget a
11 hg add
12 hg st
10 13
11 14 echo b > b
12 15 hg add -n b
@@ -36,6 +39,9 b' hg resolve -m a'
36 39 hg ci -m merge
37 40
38 41 echo % issue683
42 hg forget a
43 hg add a
44 hg st
39 45 hg rm a
40 46 hg st
41 47 echo a > a
@@ -2,6 +2,8 b' adding a'
2 2 ? a
3 3 adding a
4 4 A a
5 adding a
6 A a
5 7 A a
6 8 ? b
7 9 A a
@@ -26,6 +28,7 b' a already tracked!'
26 28 M a
27 29 ? a.orig
28 30 % issue683
31 ? a.orig
29 32 R a
30 33 ? a.orig
31 34 M a
@@ -14,6 +14,7 b' commit'
14 14 copy
15 15 diff
16 16 export
17 forget
17 18 grep
18 19 heads
19 20 help
@@ -167,6 +168,7 b' clone: noupdate, rev, pull, uncompressed'
167 168 commit: addremove, close-branch, include, exclude, message, logfile, date, user
168 169 diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, include, exclude
169 170 export: output, switch-parent, text, git, nodates
171 forget: include, exclude
170 172 init: ssh, remotecmd
171 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 174 merge: force, rev, preview
@@ -164,6 +164,7 b' list of commands:'
164 164 copy mark files as copied for the next commit
165 165 diff diff repository (or selected files)
166 166 export dump the header and diffs for one or more changesets
167 forget forget the specified files on the next commit
167 168 grep search for a pattern in specified files and revisions
168 169 heads show current repository heads or show branch heads
169 170 help show help for a given topic or a help overview
@@ -230,6 +231,7 b' list of commands:'
230 231 copy mark files as copied for the next commit
231 232 diff diff repository (or selected files)
232 233 export dump the header and diffs for one or more changesets
234 forget forget the specified files on the next commit
233 235 grep search for a pattern in specified files and revisions
234 236 heads show current repository heads or show branch heads
235 237 help show help for a given topic or a help overview
@@ -8,6 +8,7 b' basic commands:'
8 8 commit commit the specified files or all outstanding changes
9 9 diff diff repository (or selected files)
10 10 export dump the header and diffs for one or more changesets
11 forget forget the specified files on the next commit
11 12 init create a new repository in the given directory
12 13 log show revision history of entire repository or files
13 14 merge merge working directory with another revision
@@ -26,6 +27,7 b' use "hg help" for the full list of comma'
26 27 commit commit the specified files or all outstanding changes
27 28 diff diff repository (or selected files)
28 29 export dump the header and diffs for one or more changesets
30 forget forget the specified files on the next commit
29 31 init create a new repository in the given directory
30 32 log show revision history of entire repository or files
31 33 merge merge working directory with another revision
@@ -55,6 +57,7 b' list of commands:'
55 57 copy mark files as copied for the next commit
56 58 diff diff repository (or selected files)
57 59 export dump the header and diffs for one or more changesets
60 forget forget the specified files on the next commit
58 61 grep search for a pattern in specified files and revisions
59 62 heads show current repository heads or show branch heads
60 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 120 copy mark files as copied for the next commit
118 121 diff diff repository (or selected files)
119 122 export dump the header and diffs for one or more changesets
123 forget forget the specified files on the next commit
120 124 grep search for a pattern in specified files and revisions
121 125 heads show current repository heads or show branch heads
122 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 174 repository.
171 175
172 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 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 194 repository.
191 195
192 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 199 If no names are given, add all files to the repository.
196 200
@@ -309,6 +313,7 b' basic commands:'
309 313 commit commit the specified files or all outstanding changes
310 314 diff diff repository (or selected files)
311 315 export dump the header and diffs for one or more changesets
316 forget forget the specified files on the next commit
312 317 init create a new repository in the given directory
313 318 log show revision history of entire repository or files
314 319 merge merge working directory with another revision
@@ -332,6 +337,7 b' basic commands:'
332 337 commit commit the specified files or all outstanding changes
333 338 diff diff repository (or selected files)
334 339 export dump the header and diffs for one or more changesets
340 forget forget the specified files on the next commit
335 341 init create a new repository in the given directory
336 342 log show revision history of entire repository or files
337 343 merge merge working directory with another revision
@@ -10,6 +10,7 b' basic commands:'
10 10 commit commit the specified files or all outstanding changes
11 11 diff diff repository (or selected files)
12 12 export dump the header and diffs for one or more changesets
13 forget forget the specified files on the next commit
13 14 init create a new repository in the given directory
14 15 log show revision history of entire repository or files
15 16 merge merge working directory with another revision
@@ -11,6 +11,7 b' basic commands:'
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 15 init create a new repository in the given directory
15 16 log show revision history of entire repository or files
16 17 merge merge working directory with another revision
General Comments 0
You need to be logged in to leave comments. Login now