Patchwork contrib: make editmerge look for merge markers at the beginning of the line

login
register
mail settings
Submitter Christian Delahousse
Date Oct. 16, 2015, 10:06 p.m.
Message ID <2780052831c11e02e2af.1445033206@dev4253.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11152/
State Accepted
Headers show

Comments

Christian Delahousse - Oct. 16, 2015, 10:06 p.m.
# HG changeset patch
# User Christian Delahousse <cdelahousse@fb.com>
# Date 1445032902 25200
#      Fri Oct 16 15:01:42 2015 -0700
# Node ID 2780052831c11e02e2af1e47d4b2e8113b609a8b
# Parent  0c42b6bb23297d369f8c4dbd951df3d99895c9e7
contrib: make editmerge look for merge markers at the beginning of the line

This fix adds a caret to the start of the regex looking for merge markers. This
avoids the issue arises when you've real merge conflicts in a file that tests
for the existance of merge markers in test output. Editmerge will not open on
the fake/tested merge markers because they'll be indented in.
Matt Mackall - Oct. 16, 2015, 10:29 p.m.
On Fri, 2015-10-16 at 15:06 -0700, Christian Delahousse wrote:
> # HG changeset patch
> # User Christian Delahousse <cdelahousse@fb.com>
> # Date 1445032902 25200
> #      Fri Oct 16 15:01:42 2015 -0700
> # Node ID 2780052831c11e02e2af1e47d4b2e8113b609a8b
> # Parent  0c42b6bb23297d369f8c4dbd951df3d99895c9e7
> contrib: make editmerge look for merge markers at the beginning of the line

Queued for default, thanks.

Patch

diff --git a/contrib/editmerge b/contrib/editmerge
--- a/contrib/editmerge
+++ b/contrib/editmerge
@@ -13,7 +13,7 @@ 
 FILE=$1
 
 getlines() {
-  grep -n "<<<<<<" $FILE | cut -f1 -d:
+  grep -n "^<<<<<<" $FILE | cut -f1 -d:
 }
 
 # editor preference loosely based on https://mercurial-scm.org/wiki/editor