Show More
@@ -173,13 +173,15 b' copy <source ...> <dest>::' | |||||
173 | stand in the working directory. If invoked with --after, the |
|
173 | stand in the working directory. If invoked with --after, the | |
174 | operation is recorded, but no copying is performed. |
|
174 | operation is recorded, but no copying is performed. | |
175 |
|
175 | |||
176 |
This command takes effect |
|
176 | This command takes effect in the next commit. | |
177 |
|
177 | |||
178 | Options: |
|
178 | Options: | |
179 | -A, --after record a copy that has already occurred |
|
179 | -A, --after record a copy that has already occurred | |
180 | -f, --force forcibly copy over an existing managed file |
|
180 | -f, --force forcibly copy over an existing managed file | |
181 | -p, --parents append source path to dest |
|
181 | -p, --parents append source path to dest | |
182 |
|
182 | |||
|
183 | aliases: cp | |||
|
184 | ||||
183 | diff [-a] [-r revision] [-r revision] [files ...]:: |
|
185 | diff [-a] [-r revision] [-r revision] [files ...]:: | |
184 | Show differences between revisions for the specified files. |
|
186 | Show differences between revisions for the specified files. | |
185 |
|
187 | |||
@@ -448,6 +450,24 b' remove [options] [files ...]::' | |||||
448 |
|
450 | |||
449 | aliases: rm |
|
451 | aliases: rm | |
450 |
|
452 | |||
|
453 | rename <source ...> <dest>:: | |||
|
454 | Mark dest as copies of sources; mark sources for deletion. If | |||
|
455 | dest is a directory, copies are put in that directory. If dest is | |||
|
456 | a file, there can only be one source. | |||
|
457 | ||||
|
458 | By default, this command copies the contents of files as they | |||
|
459 | stand in the working directory. If invoked with --after, the | |||
|
460 | operation is recorded, but no copying is performed. | |||
|
461 | ||||
|
462 | This command takes effect in the next commit. | |||
|
463 | ||||
|
464 | Options: | |||
|
465 | -A, --after record a rename that has already occurred | |||
|
466 | -f, --force forcibly copy over an existing managed file | |||
|
467 | -p, --parents append source path to dest | |||
|
468 | ||||
|
469 | aliases: mv | |||
|
470 | ||||
451 | revert [names ...]:: |
|
471 | revert [names ...]:: | |
452 | Revert any uncommitted modifications made to the named files or |
|
472 | Revert any uncommitted modifications made to the named files or | |
453 | directories. This restores the contents of the affected files to |
|
473 | directories. This restores the contents of the affected files to |
@@ -696,8 +696,7 b' def commit(ui, repo, *pats, **opts):' | |||||
696 | except ValueError, inst: |
|
696 | except ValueError, inst: | |
697 | raise util.Abort(str(inst)) |
|
697 | raise util.Abort(str(inst)) | |
698 |
|
698 | |||
699 |
def copy(ui, repo, |
|
699 | def docopy(ui, repo, pats, opts): | |
700 | """mark files as copied for the next commit""" |
|
|||
701 | if not pats: |
|
700 | if not pats: | |
702 | raise util.Abort('no source or destination specified') |
|
701 | raise util.Abort('no source or destination specified') | |
703 | elif len(pats) == 1: |
|
702 | elif len(pats) == 1: | |
@@ -735,7 +734,7 b' def copy(ui, repo, *pats, **opts):' | |||||
735 | elif len(sources) > 1: |
|
734 | elif len(sources) > 1: | |
736 | raise util.Abort('with multiple sources, destination must be a ' |
|
735 | raise util.Abort('with multiple sources, destination must be a ' | |
737 | 'directory') |
|
736 | 'directory') | |
738 | errs = 0 |
|
737 | errs, copied = 0, [] | |
739 | for abs, rel, exact in sources: |
|
738 | for abs, rel, exact in sources: | |
740 | if opts['parents']: |
|
739 | if opts['parents']: | |
741 | mydest = os.path.join(dest, rel) |
|
740 | mydest = os.path.join(dest, rel) | |
@@ -763,6 +762,8 b' def copy(ui, repo, *pats, **opts):' | |||||
763 | n = repo.manifest.tip() |
|
762 | n = repo.manifest.tip() | |
764 | mf = repo.manifest.readflags(n) |
|
763 | mf = repo.manifest.readflags(n) | |
765 | util.set_exec(myreldest, util.is_exec(rel, mf[abs])) |
|
764 | util.set_exec(myreldest, util.is_exec(rel, mf[abs])) | |
|
765 | except shutil.Error, inst: | |||
|
766 | raise util.Abort(str(inst)) | |||
766 | except IOError, inst: |
|
767 | except IOError, inst: | |
767 | if inst.errno == errno.ENOENT: |
|
768 | if inst.errno == errno.ENOENT: | |
768 | ui.warn('%s: deleted in working copy\n' % rel) |
|
769 | ui.warn('%s: deleted in working copy\n' % rel) | |
@@ -771,8 +772,14 b' def copy(ui, repo, *pats, **opts):' | |||||
771 | errs += 1 |
|
772 | errs += 1 | |
772 | continue |
|
773 | continue | |
773 | repo.copy(abs, myabsdest) |
|
774 | repo.copy(abs, myabsdest) | |
|
775 | copied.append((abs, rel, exact)) | |||
774 | if errs: |
|
776 | if errs: | |
775 |
ui.warn('(consider using --after |
|
777 | ui.warn('(consider using --after)\n') | |
|
778 | return errs, copied | |||
|
779 | ||||
|
780 | def copy(ui, repo, *pats, **opts): | |||
|
781 | """mark files as copied for the next commit""" | |||
|
782 | errs, copied = docopy(ui, repo, pats, opts) | |||
776 | return errs |
|
783 | return errs | |
777 |
|
784 | |||
778 | def debugcheckstate(ui, repo): |
|
785 | def debugcheckstate(ui, repo): | |
@@ -1390,14 +1397,14 b' def remove(ui, repo, pat, *pats, **opts)' | |||||
1390 | reason = None |
|
1397 | reason = None | |
1391 | if c: reason = 'is modified' |
|
1398 | if c: reason = 'is modified' | |
1392 | elif a: reason = 'has been marked for add' |
|
1399 | elif a: reason = 'has been marked for add' | |
1393 | elif u: reason = 'not managed' |
|
1400 | elif u: reason = 'is not managed' | |
1394 | if reason and exact: |
|
1401 | if reason and exact: | |
1395 | ui.warn('not removing %s: file %s\n' % (rel, reason)) |
|
1402 | ui.warn('not removing %s: file %s\n' % (rel, reason)) | |
1396 | else: |
|
1403 | else: | |
1397 | return True |
|
1404 | return True | |
1398 | for src, abs, rel, exact in walk(repo, (pat,) + pats, opts): |
|
1405 | for src, abs, rel, exact in walk(repo, (pat,) + pats, opts): | |
1399 | if okaytoremove(abs, rel, exact): |
|
1406 | if okaytoremove(abs, rel, exact): | |
1400 | if not exact: ui.status('removing %s\n' % rel) |
|
1407 | if ui.verbose or not exact: ui.status('removing %s\n' % rel) | |
1401 | names.append(abs) |
|
1408 | names.append(abs) | |
1402 | for name in names: |
|
1409 | for name in names: | |
1403 | try: |
|
1410 | try: | |
@@ -1406,6 +1413,20 b' def remove(ui, repo, pat, *pats, **opts)' | |||||
1406 | if inst.errno != errno.ENOENT: raise |
|
1413 | if inst.errno != errno.ENOENT: raise | |
1407 | repo.remove(names) |
|
1414 | repo.remove(names) | |
1408 |
|
1415 | |||
|
1416 | def rename(ui, repo, *pats, **opts): | |||
|
1417 | """rename files; equivalent of copy + remove""" | |||
|
1418 | errs, copied = docopy(ui, repo, pats, opts) | |||
|
1419 | names = [] | |||
|
1420 | for abs, rel, exact in copied: | |||
|
1421 | if ui.verbose or not exact: ui.status('removing %s\n' % rel) | |||
|
1422 | try: | |||
|
1423 | os.unlink(rel) | |||
|
1424 | except OSError, inst: | |||
|
1425 | if inst.errno != errno.ENOENT: raise | |||
|
1426 | names.append(abs) | |||
|
1427 | repo.remove(names) | |||
|
1428 | return errs | |||
|
1429 | ||||
1409 | def revert(ui, repo, *names, **opts): |
|
1430 | def revert(ui, repo, *names, **opts): | |
1410 | """revert modified files or dirs back to their unmodified states""" |
|
1431 | """revert modified files or dirs back to their unmodified states""" | |
1411 | node = opts['rev'] and repo.lookup(opts['rev']) or \ |
|
1432 | node = opts['rev'] and repo.lookup(opts['rev']) or \ | |
@@ -1876,6 +1897,13 b' table = {' | |||||
1876 | [('I', 'include', [], 'include path in search'), |
|
1897 | [('I', 'include', [], 'include path in search'), | |
1877 | ('X', 'exclude', [], 'exclude path from search')], |
|
1898 | ('X', 'exclude', [], 'exclude path from search')], | |
1878 | "hg remove [OPTION]... FILE..."), |
|
1899 | "hg remove [OPTION]... FILE..."), | |
|
1900 | "rename|mv": (rename, | |||
|
1901 | [('I', 'include', [], 'include path in search'), | |||
|
1902 | ('X', 'exclude', [], 'exclude path from search'), | |||
|
1903 | ('A', 'after', None, 'record a copy after it has happened'), | |||
|
1904 | ('f', 'force', None, 'replace destination if it exists'), | |||
|
1905 | ('p', 'parents', None, 'append source path to dest')], | |||
|
1906 | 'hg rename [OPTION]... [SOURCE]... DEST'), | |||
1879 | "^revert": |
|
1907 | "^revert": | |
1880 | (revert, |
|
1908 | (revert, | |
1881 | [("n", "nonrecursive", None, "don't recurse into subdirs"), |
|
1909 | [("n", "nonrecursive", None, "don't recurse into subdirs"), |
@@ -65,6 +65,7 b' list of commands (use "hg help -v" to sh' | |||||
65 | rawcommit raw commit interface |
|
65 | rawcommit raw commit interface | |
66 | recover roll back an interrupted transaction |
|
66 | recover roll back an interrupted transaction | |
67 | remove remove the specified files on the next commit |
|
67 | remove remove the specified files on the next commit | |
|
68 | rename rename files; equivalent of copy + remove | |||
68 | revert revert modified files or dirs back to their unmodified states |
|
69 | revert revert modified files or dirs back to their unmodified states | |
69 | root print the root (top) of the current working dir |
|
70 | root print the root (top) of the current working dir | |
70 | serve export the repository via HTTP |
|
71 | serve export the repository via HTTP | |
@@ -106,6 +107,7 b' list of commands (use "hg help -v" to sh' | |||||
106 | rawcommit raw commit interface |
|
107 | rawcommit raw commit interface | |
107 | recover roll back an interrupted transaction |
|
108 | recover roll back an interrupted transaction | |
108 | remove remove the specified files on the next commit |
|
109 | remove remove the specified files on the next commit | |
|
110 | rename rename files; equivalent of copy + remove | |||
109 | revert revert modified files or dirs back to their unmodified states |
|
111 | revert revert modified files or dirs back to their unmodified states | |
110 | root print the root (top) of the current working dir |
|
112 | root print the root (top) of the current working dir | |
111 | serve export the repository via HTTP |
|
113 | serve export the repository via HTTP |
General Comments 0
You need to be logged in to leave comments.
Login now