如何使用Mac上的终端以不同方式解决同一文件中的多个冲突?

时间:2016-01-13 08:03:04

标签: svn terminal merge-conflict-resolution

当我尝试将我的代码从trunk合并到分支时,我发现了这些冲突。 在此文件中出现了多个冲突,我需要分别解决每个冲突。我是使用SVN的新手,我使用终端来提交我的代码。 这是冲突:

    Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved,
            (mc) mine-conflict, (tc) theirs-conflict,
            (s) show all options: dc      
    @@
            }

          } // end of whilefor loop for condition
    <<<<<<< MINE (select with 'mc') (1571,3)

          if(!ifScriptForPrimitiveFactFields.isEmpty()) {
            ifScriptForPrimitiveFactFields += " && (" + ifVerScriptForPrimitiveFactFields + " || hasChanged )";
    ||||||| ORIGINAL (1575,6)

          if (ifScriptForPrimitiveFactFields != null && !ifScriptForPrimitiveFactFields.isEmpty()) {
            if (rule != null && rule.isTriggerApprovalsOnValuesChange() && ifVerScriptForPrimitiveFactFields != null 
                && !ifVerScriptForPrimitiveFactFields.isEmpty()) {
              ifScriptForPrimitiveFactFields += " && (" + ifVerScriptForPrimitiveFactFields + " || hasChanged )";
            }
    =======

          if (ifScriptForPrimitiveFactFields != null && !ifScriptForPrimitiveFactFields.isEmpty()) {
            if (rule != null && rule.isTriggerApprovalsOnValuesChange() && ifVerScriptForPrimitiveFactFields != null
                && !ifVerScriptForPrimitiveFactFields.isEmpty()) {
              ifScriptForPrimitiveFactFields += " && (" + ifVerScriptForPrimitiveFactFields + " || hasChanged )";
            }
    >>>>>>> THEIRS (select with 'tc') (1575,6)
          } else {
            if(rule != null && rule.isTriggerApprovalsOnValuesChange()) {
              ifScriptForPrimitiveFactFields = "(!idToObjMap || hasChanged)";
    @@
        if(verDataMap != null) {
          idField = verDataMap.get("ID_FIELD");
        }
    <<<<<<< MINE (select with 'mc') (2313,3)
        versionCondition = "(!idToObjMap "
            + "|| (!idToObjMap?.get(i." + idField + ")) || (idToObjMap?.get(i." + idField 
            + ") && i." + factFieldScriptMappingString + subFieldStr + "!=idToObjMap?.get(i."+ idField + ")?." + factFieldScriptMappingString + subFieldStr + ")) ";
    ||||||| ORIGINAL (2334,3)
        versionCondition = "(" + Constants.IS_FIRST_SALES_APPROVAL + " || (idToObjMap?.get(i." + idField
            + ") && i." + factFieldScriptMappingString + subFieldStr + "!=idToObjMap?.get(i." + idField + ")?."
            + factFieldScriptMappingString + subFieldStr + ")) ";
    =======
        versionCondition = "(" + Constants.IS_FIRST_SALES_APPROVAL + " || (idToObjMap?.get(i." + idField + ") && i."
            + factFieldScriptMappingString + subFieldStr + "!=idToObjMap?.get(i." + idField + ")?."
            + factFieldScriptMappingString + subFieldStr + ")) ";
    >>>>>>> THEIRS (select with 'tc') (2334,3)
        return versionCondition;
      }

    @@

        Date addedDate = businessCalendar.add(submitDate, duration);
        long durationSecs = addedDate.getTime() - submitDate.getTime();
    <<<<<<< MINE (select with 'mc') (2330,3)
        expression = "(" + factFieldScriptMapping + ">=" + "order_submit_date) && (" + factFieldScriptMapping + "<="
            + "order_submit_date" + "+" + durationSecs + ")";
        return expression;
    ||||||| ORIGINAL (2351,3)
        expression = "(" + factFieldScriptMapping + "<=" + "order_submit_date ) && (" + durationSecs + "+"
            + factFieldScriptMapping + ">= " + "order_submit_date )";
        return expression;
    =======
        if (hours == 0) {
          return "(new Date(" + factFieldScriptMapping + ").getDay()" + "=="
              + "new Date(order_submit_date).getDay()) && ((" + factFieldScriptMapping + "-" + "order_submit_date"
              + ").abs()" + "<" + "86400000)";
        } else {
          expression = "(" + factFieldScriptMapping + ">" + "order_submit_date) && (" + factFieldScriptMapping + "<"
              + "order_submit_date" + "+" + durationSecs + ")";
          return expression;
        }
    >>>>>>> THEIRS (select with 'tc') (2351,9)
      }

      private String isWithinXWorkingDaysofSubmitForApprovals(List<String> values, String factFieldScriptMapping) {
    @@
              + "order_submit_date" + "+" + durationSecs + ")";
          return expression;
        }
    <<<<<<< MINE (select with 'mc') (2352,5)
        Date addedDate = businessCalendar.add(submitDate, duration);
        long durationSecs = addedDate.getTime() - submitDate.getTime();
        expression = "(" + factFieldScriptMapping + ">=" + "order_submit_date) && (" + factFieldScriptMapping + "<="
            + "order_submit_date" + "+" + durationSecs + ")";
        return expression;
    ||||||| ORIGINAL (2373,5)
        Date addedDate = businessCalendar.add(submitDate, duration);
        long durationSecs = addedDate.getTime() - submitDate.getTime();
        expression = "(" + factFieldScriptMapping + "<=" + "order_submit_date ) && (" + durationSecs + "+"
            + factFieldScriptMapping + ">= " + "order_submit_date )";
        return expression;
    =======
    >>>>>>> THEIRS (select with 'tc') (2382,0)
      }

      private String isWithinXhoursofSubmitForApprovals(List<String> values, String factFieldScriptMapping) {
    <<<<<<< MINE (select with 'mc') (2360,2)
        return "(" + factFieldScriptMapping + ">=" + "order_submit_date) && (" + factFieldScriptMapping + "<="
            + "order_submit_date" + "+" + Long.parseLong(values.get(0)) * 3600000 + ")";
    ||||||| ORIGINAL (2381,2)
        return "(" + factFieldScriptMapping + "<=" + "order_submit_date ) && (" + Long.parseLong(values.get(0)) * 3600000
            + "+" + factFieldScriptMapping + ">=" + "order_submit_date )";
    =======
        if (Long.parseLong(values.get(0)) == 0) {
          return "(new Date(" + factFieldScriptMapping + ").getDay()" + "=="
              + "new Date(order_submit_date).getDay()) && ((" + factFieldScriptMapping + "-" + "order_submit_date"
              + ").abs()" + "<" + "86400000)";
        } else {
          return "(" + factFieldScriptMapping + ">" + "order_submit_date) && (" + factFieldScriptMapping + "<"
              + "order_submit_date" + "+" + Long.parseLong(values.get(0)) * 3600000 + ")";
        }
    >>>>>>> THEIRS (select with 'tc') (2385,8)
      }

      private String isWithinXdayofSubmitForApprovals(List<String> values, String factFieldScriptMapping) {
    <<<<<<< MINE (select with 'mc') (2365,2)
        return "(" + factFieldScriptMapping + ">=" + "order_submit_date) && (" + factFieldScriptMapping + "<="
            + "order_submit_date" + "+" + Long.parseLong(values.get(0)) * 86400000 + ")";
    ||||||| ORIGINAL (2386,2)
        return "(" + factFieldScriptMapping + "<=" + "order_submit_date ) && (" + Long.parseLong(values.get(0)) * 86400000
            + "+" + factFieldScriptMapping + ">=" + "order_submit_date)";
    =======
        if (Long.parseLong(values.get(0)) == 0) {
          return "(new Date(" + factFieldScriptMapping + ").getDay()" + "=="
              + "new Date(order_submit_date).getDay()) && ((" + factFieldScriptMapping + "-" + "order_submit_date"
              + ").abs()" + "<" + "86400000)";
        } else {
          return "(" + factFieldScriptMapping + ">" + "order_submit_date) && (" + factFieldScriptMapping + "<"
              + "order_submit_date" + "+" + Long.parseLong(values.get(0)) * 86400000 + ")";
        }
    >>>>>>> THEIRS (select with 'tc') (2396,8)
      }
@Override
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved,
        (mc) mine-conflict, (tc) theirs-conflict,
        (s) show all options: 

在这里,我有第一次冲突(1571,3)我需要做一个 mc(我的冲突)来保留原始代码并删除我的更改,其余的我已经使用< strong> tc(他们的冲突)保留我的更改并删除原始代码。 但我只能在终端输入一个选项。

请您帮我弄清楚如何对不同冲突的同一文件进行多次更改。

1 个答案:

答案 0 :(得分:3)

您基本上有两种选择:

  • 使用&#39; e&#39; (编辑): 在这种情况下,编辑器将打开相关文件并包含您在dc输出中看到的所有冲突标记。然后,您可以搜索<<<<<<<以查找所有冲突的区域,手动解决它们,并在保存并关闭编辑器后,单击r以标记此文件的冲突已解决。

  • 使用&#39; p&#39; (推迟): 在这种情况下,svn将不执行任何操作并继续下一个文件。合并过程完成并运行svn st后,您会看到标有p的文件标有C(出于冲突)。然后,您可以继续手动解决所有冲突,如上所述。完成后,您需要执行svn resolve --accept=working filename告诉svn您已完成冲突解决。