2707 [('o', 'output', '', |
2707 [('o', 'output', '', |
2708 _('print output to file with formatted name'), _('FORMAT')), |
2708 _('print output to file with formatted name'), _('FORMAT')), |
2709 ('', 'switch-parent', None, _('diff against the second parent')), |
2709 ('', 'switch-parent', None, _('diff against the second parent')), |
2710 ('r', 'rev', [], _('revisions to export'), _('REV')), |
2710 ('r', 'rev', [], _('revisions to export'), _('REV')), |
2711 ] + diffopts, |
2711 ] + diffopts, |
2712 _('[OPTION]... [-o OUTFILESPEC] [-r] REV...')) |
2712 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...')) |
2713 def export(ui, repo, *changesets, **opts): |
2713 def export(ui, repo, *changesets, **opts): |
2714 """dump the header and diffs for one or more changesets |
2714 """dump the header and diffs for one or more changesets |
2715 |
2715 |
2716 Print the changeset header and diffs for one or more revisions. |
2716 Print the changeset header and diffs for one or more revisions. |
|
2717 If no revision is given, the parent of the working directory is used. |
2717 |
2718 |
2718 The information shown in the changeset header is: author, date, |
2719 The information shown in the changeset header is: author, date, |
2719 branch name (if non-default), changeset hash, parent(s) and commit |
2720 branch name (if non-default), changeset hash, parent(s) and commit |
2720 comment. |
2721 comment. |
2721 |
2722 |
2767 hg export -r "outgoing()" -o "%n-%m.patch" |
2768 hg export -r "outgoing()" -o "%n-%m.patch" |
2768 |
2769 |
2769 Returns 0 on success. |
2770 Returns 0 on success. |
2770 """ |
2771 """ |
2771 changesets += tuple(opts.get('rev', [])) |
2772 changesets += tuple(opts.get('rev', [])) |
|
2773 if not changesets: |
|
2774 changesets = ['.'] |
2772 revs = scmutil.revrange(repo, changesets) |
2775 revs = scmutil.revrange(repo, changesets) |
2773 if not revs: |
2776 if not revs: |
2774 raise util.Abort(_("export requires at least one changeset")) |
2777 raise util.Abort(_("export requires at least one changeset")) |
2775 if len(revs) > 1: |
2778 if len(revs) > 1: |
2776 ui.note(_('exporting patches:\n')) |
2779 ui.note(_('exporting patches:\n')) |