Show More
@@ -60,7 +60,7 add [options] [files ...]:: | |||||
60 | If no names are given, add all files in the current directory and |
|
60 | If no names are given, add all files in the current directory and | |
61 | its subdirectories. |
|
61 | its subdirectories. | |
62 |
|
62 | |||
63 | addremove:: |
|
63 | addremove [options] [files ...]:: | |
64 | Add all new files and remove all missing files from the repository. |
|
64 | Add all new files and remove all missing files from the repository. | |
65 |
|
65 | |||
66 | New files are ignored if they match any of the patterns in .hgignore. As |
|
66 | New files are ignored if they match any of the patterns in .hgignore. As |
@@ -329,23 +329,19 def add(ui, repo, *pats, **opts): | |||||
329 | names.append(abs) |
|
329 | names.append(abs) | |
330 | repo.add(names) |
|
330 | repo.add(names) | |
331 |
|
331 | |||
332 |
def addremove(ui, repo, * |
|
332 | def addremove(ui, repo, *pats, **opts): | |
333 | """add all new files, delete all missing files""" |
|
333 | """add all new files, delete all missing files""" | |
334 | if files: |
|
334 | q = dict(zip(pats, pats)) | |
335 | files = relpath(repo, files) |
|
335 | cwd = repo.getcwd() | |
336 | d = [] |
|
336 | n = (cwd and len(cwd) + 1) or 0 | |
337 | u = [] |
|
337 | c, a, d, u = repo.changes(match = matchpats(cwd, pats, opts)) | |
338 |
|
|
338 | for f in u: | |
339 | p = repo.wjoin(f) |
|
339 | if f not in q: | |
340 | s = repo.dirstate.state(f) |
|
340 | ui.status('adding %s\n' % f[n:]) | |
341 | isfile = os.path.isfile(p) |
|
|||
342 | if s != 'r' and not isfile: |
|
|||
343 | d.append(f) |
|
|||
344 | elif s not in 'nmai' and isfile: |
|
|||
345 | u.append(f) |
|
|||
346 | else: |
|
|||
347 | (c, a, d, u) = repo.changes() |
|
|||
348 | repo.add(u) |
|
341 | repo.add(u) | |
|
342 | for f in d: | |||
|
343 | if f not in q: | |||
|
344 | ui.status('removing %s\n' % f[n:]) | |||
349 | repo.remove(d) |
|
345 | repo.remove(d) | |
350 |
|
346 | |||
351 | def annotate(ui, repo, *pats, **opts): |
|
347 | def annotate(ui, repo, *pats, **opts): | |
@@ -1086,7 +1082,10 table = { | |||||
1086 | [('I', 'include', [], 'include path in search'), |
|
1082 | [('I', 'include', [], 'include path in search'), | |
1087 | ('X', 'exclude', [], 'exclude path from search')], |
|
1083 | ('X', 'exclude', [], 'exclude path from search')], | |
1088 | "hg add [FILE]..."), |
|
1084 | "hg add [FILE]..."), | |
1089 |
"addremove": (addremove, |
|
1085 | "addremove": (addremove, | |
|
1086 | [('I', 'include', [], 'include path in search'), | |||
|
1087 | ('X', 'exclude', [], 'exclude path from search')], | |||
|
1088 | "hg addremove [OPTION]... [FILE]..."), | |||
1090 | "^annotate": |
|
1089 | "^annotate": | |
1091 | (annotate, |
|
1090 | (annotate, | |
1092 | [('r', 'rev', '', 'revision'), |
|
1091 | [('r', 'rev', '', 'revision'), |
General Comments 0
You need to be logged in to leave comments.
Login now