mercurial/commands.py
changeset 38015 c76526d7d6e9
parent 37920 ea63a2004d09
child 38100 18424aeece7f
equal deleted inserted replaced
38014:768bd75835d7 38015:c76526d7d6e9
    48     patch,
    48     patch,
    49     phases,
    49     phases,
    50     pycompat,
    50     pycompat,
    51     rcutil,
    51     rcutil,
    52     registrar,
    52     registrar,
       
    53     repair,
    53     revsetlang,
    54     revsetlang,
    54     rewriteutil,
    55     rewriteutil,
    55     scmutil,
    56     scmutil,
    56     server,
    57     server,
    57     streamclone,
    58     streamclone,
  1893     logcmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
  1894     logcmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
  1894                               listsubrepos=opts.get('subrepos'),
  1895                               listsubrepos=opts.get('subrepos'),
  1895                               root=opts.get('root'))
  1896                               root=opts.get('root'))
  1896 
  1897 
  1897 @command('^export',
  1898 @command('^export',
  1898     [('o', 'output', '',
  1899     [('B', 'bookmark', '',
       
  1900      _('export changes only reachable by given bookmark')),
       
  1901     ('o', 'output', '',
  1899      _('print output to file with formatted name'), _('FORMAT')),
  1902      _('print output to file with formatted name'), _('FORMAT')),
  1900     ('', 'switch-parent', None, _('diff against the second parent')),
  1903     ('', 'switch-parent', None, _('diff against the second parent')),
  1901     ('r', 'rev', [], _('revisions to export'), _('REV')),
  1904     ('r', 'rev', [], _('revisions to export'), _('REV')),
  1902     ] + diffopts + formatteropts,
  1905     ] + diffopts + formatteropts,
  1903     _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'),
  1906     _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'),
  1936 
  1939 
  1937     Without the -a/--text option, export will avoid generating diffs
  1940     Without the -a/--text option, export will avoid generating diffs
  1938     of files it detects as binary. With -a, export will generate a
  1941     of files it detects as binary. With -a, export will generate a
  1939     diff anyway, probably with undesirable results.
  1942     diff anyway, probably with undesirable results.
  1940 
  1943 
       
  1944     With -B/--bookmark changesets reachable by the given bookmark are
       
  1945     selected.
       
  1946 
  1941     Use the -g/--git option to generate diffs in the git extended diff
  1947     Use the -g/--git option to generate diffs in the git extended diff
  1942     format. See :hg:`help diffs` for more information.
  1948     format. See :hg:`help diffs` for more information.
  1943 
  1949 
  1944     With the --switch-parent option, the diff will be against the
  1950     With the --switch-parent option, the diff will be against the
  1945     second parent. It can be useful to review a merge.
  1951     second parent. It can be useful to review a merge.
  1964           hg export -r "outgoing()" -o "%n-%m.patch"
  1970           hg export -r "outgoing()" -o "%n-%m.patch"
  1965 
  1971 
  1966     Returns 0 on success.
  1972     Returns 0 on success.
  1967     """
  1973     """
  1968     opts = pycompat.byteskwargs(opts)
  1974     opts = pycompat.byteskwargs(opts)
       
  1975     bookmark = opts.get('bookmark')
  1969     changesets += tuple(opts.get('rev', []))
  1976     changesets += tuple(opts.get('rev', []))
  1970     if not changesets:
  1977 
  1971         changesets = ['.']
  1978     if bookmark and changesets:
  1972     repo = scmutil.unhidehashlikerevs(repo, changesets, 'nowarn')
  1979         raise error.Abort(_("-r and -B are mutually exclusive"))
  1973     revs = scmutil.revrange(repo, changesets)
  1980 
       
  1981     if bookmark:
       
  1982         if bookmark not in repo._bookmarks:
       
  1983             raise error.Abort(_("bookmark '%s' not found") % bookmark)
       
  1984 
       
  1985         revs = repair.stripbmrevset(repo, bookmark)
       
  1986     else:
       
  1987         if not changesets:
       
  1988             changesets = ['.']
       
  1989 
       
  1990         repo = scmutil.unhidehashlikerevs(repo, changesets, 'nowarn')
       
  1991         revs = scmutil.revrange(repo, changesets)
       
  1992 
  1974     if not revs:
  1993     if not revs:
  1975         raise error.Abort(_("export requires at least one changeset"))
  1994         raise error.Abort(_("export requires at least one changeset"))
  1976     if len(revs) > 1:
  1995     if len(revs) > 1:
  1977         ui.note(_('exporting patches:\n'))
  1996         ui.note(_('exporting patches:\n'))
  1978     else:
  1997     else: