tests/test-simplemerge-cmd.t
changeset 12488 73ad7274ccfa
parent 8448 0eb8c4df61bd
child 12943 7439ea4146f8
equal deleted inserted replaced
12487:9792013e2f53 12488:73ad7274ccfa
       
     1 
       
     2   $ cp "$TESTDIR"/../contrib/simplemerge .
       
     3   $ echo base > base
       
     4   $ echo local > local
       
     5   $ cat base >> local
       
     6   $ cp local orig
       
     7   $ cat base > other
       
     8   $ echo other >> other
       
     9 
       
    10 changing local directly
       
    11 
       
    12   $ python simplemerge local base other && echo "merge succeeded"
       
    13   merge succeeded
       
    14   $ cat local
       
    15   local
       
    16   base
       
    17   other
       
    18   $ cp orig local
       
    19 
       
    20 printing to stdout
       
    21 
       
    22   $ python simplemerge -p local base other
       
    23   local
       
    24   base
       
    25   other
       
    26 
       
    27 local:
       
    28 
       
    29   $ cat local
       
    30   local
       
    31   base
       
    32 
       
    33 conflicts
       
    34 
       
    35   $ cp base conflict-local
       
    36   $ cp other conflict-other
       
    37   $ echo not other >> conflict-local
       
    38   $ echo end >> conflict-local
       
    39   $ echo end >> conflict-other
       
    40   $ python simplemerge -p conflict-local base conflict-other
       
    41   base
       
    42   <<<<<<< conflict-local
       
    43   not other
       
    44   =======
       
    45   other
       
    46   >>>>>>> conflict-other
       
    47   end
       
    48   warning: conflicts during merge.
       
    49   [1]
       
    50 
       
    51 --no-minimal
       
    52 
       
    53   $ python simplemerge -p --no-minimal conflict-local base conflict-other
       
    54   base
       
    55   <<<<<<< conflict-local
       
    56   not other
       
    57   end
       
    58   =======
       
    59   other
       
    60   end
       
    61   >>>>>>> conflict-other
       
    62   warning: conflicts during merge.
       
    63   [1]
       
    64 
       
    65 1 label
       
    66 
       
    67   $ python simplemerge -p -L foo conflict-local base conflict-other
       
    68   base
       
    69   <<<<<<< foo
       
    70   not other
       
    71   =======
       
    72   other
       
    73   >>>>>>> conflict-other
       
    74   end
       
    75   warning: conflicts during merge.
       
    76   [1]
       
    77 
       
    78 2 labels
       
    79 
       
    80   $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
       
    81   base
       
    82   <<<<<<< foo
       
    83   not other
       
    84   =======
       
    85   other
       
    86   >>>>>>> bar
       
    87   end
       
    88   warning: conflicts during merge.
       
    89   [1]
       
    90 
       
    91 too many labels
       
    92 
       
    93   $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
       
    94   abort: can only specify two labels.
       
    95   [255]
       
    96 
       
    97 binary file
       
    98 
       
    99   $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
       
   100   $ cat orig >> binary-local
       
   101   $ python simplemerge -p binary-local base other
       
   102   abort: binary-local looks like a binary file.
       
   103   [255]
       
   104 
       
   105 binary file --text
       
   106 
       
   107   $ python simplemerge -a -p binary-local base other 2>&1 | $TESTDIR/printrepr.py
       
   108   warning: binary-local looks like a binary file.
       
   109   \x00local
       
   110   base
       
   111   other
       
   112 
       
   113 help
       
   114 
       
   115   $ python simplemerge --help
       
   116   simplemerge [OPTS] LOCAL BASE OTHER
       
   117   
       
   118       Simple three-way file merge utility with a minimal feature set.
       
   119   
       
   120       Apply to LOCAL the changes necessary to go from BASE to OTHER.
       
   121   
       
   122       By default, LOCAL is overwritten with the results of this operation.
       
   123   
       
   124   options:
       
   125    -L --label       labels to use on conflict markers
       
   126    -a --text        treat all files as text
       
   127    -p --print       print results instead of overwriting LOCAL
       
   128       --no-minimal  do not try to minimize conflict regions
       
   129    -h --help        display help and exit
       
   130    -q --quiet       suppress output
       
   131 
       
   132 wrong number of arguments
       
   133 
       
   134   $ python simplemerge
       
   135   simplemerge: wrong number of arguments
       
   136   simplemerge [OPTS] LOCAL BASE OTHER
       
   137   
       
   138       Simple three-way file merge utility with a minimal feature set.
       
   139   
       
   140       Apply to LOCAL the changes necessary to go from BASE to OTHER.
       
   141   
       
   142       By default, LOCAL is overwritten with the results of this operation.
       
   143   
       
   144   options:
       
   145    -L --label       labels to use on conflict markers
       
   146    -a --text        treat all files as text
       
   147    -p --print       print results instead of overwriting LOCAL
       
   148       --no-minimal  do not try to minimize conflict regions
       
   149    -h --help        display help and exit
       
   150    -q --quiet       suppress output
       
   151   [1]
       
   152 
       
   153 bad option
       
   154 
       
   155   $ python simplemerge --foo -p local base other
       
   156   simplemerge: option --foo not recognized
       
   157   simplemerge [OPTS] LOCAL BASE OTHER
       
   158   
       
   159       Simple three-way file merge utility with a minimal feature set.
       
   160   
       
   161       Apply to LOCAL the changes necessary to go from BASE to OTHER.
       
   162   
       
   163       By default, LOCAL is overwritten with the results of this operation.
       
   164   
       
   165   options:
       
   166    -L --label       labels to use on conflict markers
       
   167    -a --text        treat all files as text
       
   168    -p --print       print results instead of overwriting LOCAL
       
   169       --no-minimal  do not try to minimize conflict regions
       
   170    -h --help        display help and exit
       
   171    -q --quiet       suppress output
       
   172   [1]