Commits

Ronny Pfannschmidt committed b7a85c2

use diff command for the implementation and reuse the complete set of the diff command args

Comments (0)

Files changed (1)

 
     Mercurial extension to quickly paste a diff to a LodgeIt instance.
 
-    Usage: activate the extension and set the name of your server in hgrc::
-
-        [extensions]
-        hgpaste = path/to/hgpaste.py
-
-        [paste]
-        server = http://paste.pocoo.org/
-
-    Then, use "hg paste [FILES]" to paste the current changes to FILES in the
-    working dir, or "hg paste -r REV" to paste an export of the specified
-    revision.
 
     :copyright: 2009 by Georg Brandl.
     :license:
         win32clipboard.CloseClipboard()
 
 def paste(ui, repo, *pats, **opts):
+    """
+    quickly paste a diff to a Lodgeit instance
+
+    activate the extension and set the name of your server in hgrc::
+
+        [extensions]
+        hgpaste = path/to/hgpaste.py
+
+        [paste]
+        server = http://paste.pocoo.org/
+
+    """
     import xmlrpclib
     server = ui.config('paste', 'server', 'http://paste.pocoo.org/')
     if not server.endswith('/'):
         server += '/'
     proxy = xmlrpclib.ServerProxy(server + 'xmlrpc/', allow_none=True)
 
+    opts['color'] = 'never'
     ui.pushbuffer()
-    if opts['rev']:
-        revs = cmdutil.revrange(repo, opts.pop('rev'))
-        patch.export(repo, revs, fp=ui, opts=patch.diffopts(ui, opts))
-    else:
-        commands.diff(ui, repo, *pats, **opts)
+    commands.diff(ui, repo, *pats, **opts)
     content = ui.popbuffer()
     if not content:
         ui.warn('Error: nothing to paste.\n')
             copy_to_clipboard(url)
 
 cmdtable = {
-    'paste':
-        (paste,
-         [('r', 'rev', '', 'paste specified revision(s)'),
-          ('n', 'nopaste', None, 'do not copy to clipboard')] + commands.diffopts,
-         'hg paste [-r REV | FILE...]')
+    '^paste': (
+        paste,
+        commands.table['^diff'][1] + [('n', 'nopaste', None, 'do not copy to clipboard')],
+        commands.table['^diff'][2],
+    )
 }