Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
967 B

  1. $infilename = shift;
  2. $outfilename1 = shift;
  3. $outfilename2 = shift;
  4. open INPUT, $infilename || die;
  5. @input = <INPUT>;
  6. close INPUT;
  7. open MERGEDMINE, ">$outfilename1" || die;
  8. open MERGEDTHEIRS, ">$outfilename2" || die;
  9. for( $i = 0; $i < scalar( @input ); $i++ )
  10. {
  11. $line = $input[$i];
  12. if( $line =~ m/^(.*)<<<<<<</ )
  13. {
  14. $first = 1;
  15. $second = 0;
  16. print MERGEDMINE $1;
  17. print MERGEDTHEIRS $1;
  18. next;
  19. }
  20. # Make sure that we are in a split block so that comments with ======= don't mess us up.
  21. if( $line =~ m/^(.*)=======$/ && $first == 1 )
  22. {
  23. $first = 0;
  24. $second = 1;
  25. print MERGEDMINE $1;
  26. next;
  27. }
  28. if( $line =~ m/^(.*)>>>>>>>/ )
  29. {
  30. $first = $second = 0;
  31. print MERGEDTHEIRS $1;
  32. next;
  33. }
  34. if( $first )
  35. {
  36. print MERGEDMINE $line;
  37. }
  38. elsif( $second )
  39. {
  40. print MERGEDTHEIRS $line;
  41. }
  42. else
  43. {
  44. print MERGEDMINE $line;
  45. print MERGEDTHEIRS $line;
  46. }
  47. }
  48. close MERGEDMINE;
  49. close MERGEDTHEIRS;