mercurial/commands.py
changeset 6582 5acbdd3941c4
parent 6579 0159b7a36184
child 6583 3951e04ea989
equal deleted inserted replaced
6581:1ae7cb678d24 6582:5acbdd3941c4
   957     it detects as binary. With -a, diff will generate a diff anyway,
   957     it detects as binary. With -a, diff will generate a diff anyway,
   958     probably with undesirable results.
   958     probably with undesirable results.
   959     """
   959     """
   960     node1, node2 = cmdutil.revpair(repo, opts['rev'])
   960     node1, node2 = cmdutil.revpair(repo, opts['rev'])
   961 
   961 
   962     fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
   962     m = cmdutil.match(repo, pats, opts)
   963 
   963     patch.diff(repo, node1, node2, m.files(), match=m,
   964     patch.diff(repo, node1, node2, fns, match=matchfn,
       
   965                opts=patch.diffopts(ui, opts))
   964                opts=patch.diffopts(ui, opts))
   966 
   965 
   967 def export(ui, repo, *changesets, **opts):
   966 def export(ui, repo, *changesets, **opts):
   968     """dump the header and diffs for one or more changesets
   967     """dump the header and diffs for one or more changesets
   969 
   968 
  1956         ctx = repo.changectx(rev)
  1955         ctx = repo.changectx(rev)
  1957     else:
  1956     else:
  1958         ctx = repo.workingctx()
  1957         ctx = repo.workingctx()
  1959 
  1958 
  1960     if file_:
  1959     if file_:
  1961         files, match, anypats = cmdutil.matchpats(repo, (file_,), opts)
  1960         m = cmdutil.match(repo, (file_,), opts)
  1962         if anypats or len(files) != 1:
  1961         if m.anypats() or len(m.files()) != 1:
  1963             raise util.Abort(_('can only specify an explicit file name'))
  1962             raise util.Abort(_('can only specify an explicit file name'))
  1964         file_ = files[0]
  1963         file_ = m.files()[0]
  1965         filenodes = []
  1964         filenodes = []
  1966         for cp in ctx.parents():
  1965         for cp in ctx.parents():
  1967             if not cp:
  1966             if not cp:
  1968                 continue
  1967                 continue
  1969             try:
  1968             try:
  2128 
  2127 
  2129     ui.warn(_("(the rawcommit command is deprecated)\n"))
  2128     ui.warn(_("(the rawcommit command is deprecated)\n"))
  2130 
  2129 
  2131     message = cmdutil.logmessage(opts)
  2130     message = cmdutil.logmessage(opts)
  2132 
  2131 
  2133     files, match, anypats = cmdutil.matchpats(repo, pats, opts)
  2132     files = cmdutil.match(repo, pats, opts).files()
  2134     if opts['files']:
  2133     if opts['files']:
  2135         files += open(opts['files']).read().splitlines()
  2134         files += open(opts['files']).read().splitlines()
  2136 
  2135 
  2137     parents = [repo.lookup(p) for p in opts['parent']]
  2136     parents = [repo.lookup(p) for p in opts['parent']]
  2138 
  2137 
  2180 
  2179 
  2181     after, force = opts.get('after'), opts.get('force')
  2180     after, force = opts.get('after'), opts.get('force')
  2182     if not pats and not after:
  2181     if not pats and not after:
  2183         raise util.Abort(_('no files specified'))
  2182         raise util.Abort(_('no files specified'))
  2184 
  2183 
  2185     files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
  2184     m = cmdutil.match(repo, pats, opts)
  2186     mardu = map(dict.fromkeys, repo.status(files=files, match=matchfn))[:5]
  2185     mardu = map(dict.fromkeys, repo.status(files=m.files(), match=m))[:5]
  2187     modified, added, removed, deleted, unknown = mardu
  2186     modified, added, removed, deleted, unknown = mardu
  2188 
  2187 
  2189     remove, forget = [], []
  2188     remove, forget = [], []
  2190     m = cmdutil.match(repo, pats, opts)
       
  2191     for src, abs, rel, exact in cmdutil.walk(repo, m):
  2189     for src, abs, rel, exact in cmdutil.walk(repo, m):
  2192 
  2190 
  2193         reason = None
  2191         reason = None
  2194         if abs in removed or abs in unknown:
  2192         if abs in removed or abs in unknown:
  2195             continue
  2193             continue
  2632     """
  2630     """
  2633 
  2631 
  2634     all = opts['all']
  2632     all = opts['all']
  2635     node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
  2633     node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
  2636 
  2634 
  2637     files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
  2635     matcher = cmdutil.match(repo, pats, opts)
  2638     cwd = (pats and repo.getcwd()) or ''
  2636     cwd = (pats and repo.getcwd()) or ''
  2639     modified, added, removed, deleted, unknown, ignored, clean = [
  2637     modified, added, removed, deleted, unknown, ignored, clean = [
  2640         n for n in repo.status(node1=node1, node2=node2, files=files,
  2638         n for n in repo.status(node1, node2, matcher.files(), matcher,
  2641                                match=matchfn,
       
  2642                                list_ignored=opts['ignored']
  2639                                list_ignored=opts['ignored']
  2643                                             or all and not ui.quiet,
  2640                                             or all and not ui.quiet,
  2644                                list_clean=opts['clean'] or all,
  2641                                list_clean=opts['clean'] or all,
  2645                                list_unknown=opts['unknown']
  2642                                list_unknown=opts['unknown']
  2646                                             or not (ui.quiet or
  2643                                             or not (ui.quiet or