220 if opts['parent']: |
220 if opts['parent']: |
221 raise util.Abort(_('cannot use --parent on non-merge changeset')) |
221 raise util.Abort(_('cannot use --parent on non-merge changeset')) |
222 parent = p1 |
222 parent = p1 |
223 hg.clean(repo, node, show_stats=False) |
223 hg.clean(repo, node, show_stats=False) |
224 revert_opts = opts.copy() |
224 revert_opts = opts.copy() |
|
225 revert_opts['date'] = None |
225 revert_opts['all'] = True |
226 revert_opts['all'] = True |
226 revert_opts['rev'] = hex(parent) |
227 revert_opts['rev'] = hex(parent) |
227 revert(ui, repo, **revert_opts) |
228 revert(ui, repo, **revert_opts) |
228 commit_opts = opts.copy() |
229 commit_opts = opts.copy() |
229 commit_opts['addremove'] = False |
230 commit_opts['addremove'] = False |
1594 ui.write("%40s " % hex(m[f])) |
1595 ui.write("%40s " % hex(m[f])) |
1595 if ui.verbose: |
1596 if ui.verbose: |
1596 ui.write("%3s " % (m.execf(f) and "755" or "644")) |
1597 ui.write("%3s " % (m.execf(f) and "755" or "644")) |
1597 ui.write("%s\n" % f) |
1598 ui.write("%s\n" % f) |
1598 |
1599 |
1599 def merge(ui, repo, node=None, force=None, branch=None): |
1600 def merge(ui, repo, node=None, force=None, branch=None, date=None): |
1600 """Merge working directory with another revision |
1601 """Merge working directory with another revision |
1601 |
1602 |
1602 Merge the contents of the current working directory and the |
1603 Merge the contents of the current working directory and the |
1603 requested revision. Files that changed between either parent are |
1604 requested revision. Files that changed between either parent are |
1604 marked as changed for the next commit and a commit must be |
1605 marked as changed for the next commit and a commit must be |
1940 |
1941 |
1941 If names are given, all files matching the names are reverted. |
1942 If names are given, all files matching the names are reverted. |
1942 |
1943 |
1943 If no arguments are given, no files are reverted. |
1944 If no arguments are given, no files are reverted. |
1944 """ |
1945 """ |
|
1946 |
|
1947 if opts["date"]: |
|
1948 if opts["rev"]: |
|
1949 raise util.Abort(_("you can't specify a revision and a date")) |
|
1950 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) |
1945 |
1951 |
1946 if not pats and not opts['all']: |
1952 if not pats and not opts['all']: |
1947 raise util.Abort(_('no files or directories specified; ' |
1953 raise util.Abort(_('no files or directories specified; ' |
1948 'use --all to revert the whole repo')) |
1954 'use --all to revert the whole repo')) |
1949 |
1955 |
2295 """ |
2301 """ |
2296 gen = changegroup.readbundle(urllib.urlopen(fname)) |
2302 gen = changegroup.readbundle(urllib.urlopen(fname)) |
2297 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
2303 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
2298 return postincoming(ui, repo, modheads, opts['update']) |
2304 return postincoming(ui, repo, modheads, opts['update']) |
2299 |
2305 |
2300 def update(ui, repo, node=None, clean=False, branch=None): |
2306 def update(ui, repo, node=None, clean=False, branch=None, date=None): |
2301 """update or merge working directory |
2307 """update or merge working directory |
2302 |
2308 |
2303 Update the working directory to the specified revision. |
2309 Update the working directory to the specified revision. |
2304 |
2310 |
2305 If there are no outstanding changes in the working directory and |
2311 If there are no outstanding changes in the working directory and |
2310 merge command. |
2316 merge command. |
2311 |
2317 |
2312 By default, update will refuse to run if doing so would require |
2318 By default, update will refuse to run if doing so would require |
2313 merging or discarding local changes. |
2319 merging or discarding local changes. |
2314 """ |
2320 """ |
|
2321 if date: |
|
2322 if node: |
|
2323 raise util.Abort(_("you can't specify a revision and a date")) |
|
2324 node = cmdutil.finddate(ui, repo, date) |
|
2325 |
2315 node = _lookup(repo, node, branch) |
2326 node = _lookup(repo, node, branch) |
2316 if clean: |
2327 if clean: |
2317 return hg.clean(repo, node) |
2328 return hg.clean(repo, node) |
2318 else: |
2329 else: |
2319 return hg.update(repo, node) |
2330 return hg.update(repo, node) |
2674 ] + walkopts + dryrunopts, |
2685 ] + walkopts + dryrunopts, |
2675 _('hg rename [OPTION]... SOURCE... DEST')), |
2686 _('hg rename [OPTION]... SOURCE... DEST')), |
2676 "^revert": |
2687 "^revert": |
2677 (revert, |
2688 (revert, |
2678 [('a', 'all', None, _('revert all changes when no arguments given')), |
2689 [('a', 'all', None, _('revert all changes when no arguments given')), |
|
2690 ('d', 'date', '', _('tipmost revision matching date')), |
2679 ('r', 'rev', '', _('revision to revert to')), |
2691 ('r', 'rev', '', _('revision to revert to')), |
2680 ('', 'no-backup', None, _('do not save backup copies of files')), |
2692 ('', 'no-backup', None, _('do not save backup copies of files')), |
2681 ] + walkopts + dryrunopts, |
2693 ] + walkopts + dryrunopts, |
2682 _('hg revert [-r REV] [NAME]...')), |
2694 _('hg revert [-r REV] [NAME]...')), |
2683 "rollback": (rollback, [], _('hg rollback')), |
2695 "rollback": (rollback, [], _('hg rollback')), |
2744 _('hg unbundle [-u] FILE')), |
2756 _('hg unbundle [-u] FILE')), |
2745 "^update|up|checkout|co": |
2757 "^update|up|checkout|co": |
2746 (update, |
2758 (update, |
2747 [('b', 'branch', '', |
2759 [('b', 'branch', '', |
2748 _('checkout the head of a specific branch (DEPRECATED)')), |
2760 _('checkout the head of a specific branch (DEPRECATED)')), |
2749 ('C', 'clean', None, _('overwrite locally modified files'))], |
2761 ('C', 'clean', None, _('overwrite locally modified files')), |
|
2762 ('d', 'date', '', _('tipmost revision matching date'))], |
2750 _('hg update [-C] [REV]')), |
2763 _('hg update [-C] [REV]')), |
2751 "verify": (verify, [], _('hg verify')), |
2764 "verify": (verify, [], _('hg verify')), |
2752 "version": (version_, [], _('hg version')), |
2765 "version": (version_, [], _('hg version')), |
2753 } |
2766 } |
2754 |
2767 |