Patchwork [2,of,9] mdiff.diffopts: add a new noprefix option

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 13, 2014, 8:22 a.m.
Message ID <9d05403982150c69e5c3.1415866930@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6708/
State Superseded
Commit ec8c73b02e2eb791e59e3137700522d62674b893
Headers show

Comments

Siddharth Agarwal - Nov. 13, 2014, 8:22 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1415863532 28800
#      Wed Nov 12 23:25:32 2014 -0800
# Node ID 9d05403982150c69e5c3e48e4968711d5fd68752
# Parent  c69f0be399be0f7044196415792e04b7946bfd35
mdiff.diffopts: add a new noprefix option

By popular demand, we introduce an option to disable the 'a/' and 'b/'
prefixes in diff output. This makes copying and pasting filenames from diff
output easier.

This option will be implemented and documented in upcoming patches. To ensure
that existing scripts that parse output don't break, we will ensure that this
prefix is disabled in plain mode. A straight 'hg export | hg import' without
HGPLAIN=1 will still be broken though, but there's little that can be done
about that.

Patch

diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -26,6 +26,7 @@ 
     git enables the git extended patch format
     nodates removes dates from diff headers
     nobinary ignores binary files
+    noprefix disables the 'a/' and 'b/' prefixes (ignored in plain mode)
     ignorews ignores all whitespace changes in the diff
     ignorewsamount ignores changes in the amount of whitespace
     ignoreblanklines ignores changes whose lines are all blank
@@ -39,6 +40,7 @@ 
         'git': False,
         'nodates': False,
         'nobinary': False,
+        'noprefix': False,
         'ignorews': False,
         'ignorewsamount': False,
         'ignoreblanklines': False,