[darcs-devel] conflicts, nested mergers, markers

Tommy Pettersson ptp at lysator.liu.se
Wed Feb 2 15:49:08 PST 2005


I'm not sure this is a bug, but it is probably unexpected
behavior (at least to me).  I don't think I can recreate the
exact situation, so I'll explain in general what happened.

I was working in a branch and pulled a patch from the trunk
and got a conflict.

---------------- TRUNK ----------------:

static void
rmsource(int s)
{
	esrc[s].inuse = 0;
	esrc[s].size = 0;
	esrc[s].count = 0;
	esrc[s].head = esrc[s].tail = 0;
	/* update nsrc */
	while (! esrc[nsrc-1].inuse)
		nsrc--;
}

--#

---------------- PATCH ----------------:

[update nsrc in rmsource()
Tommy Pettersson <ptp at lysator.liu.se>**20050202215553] {
hunk ./9libs-1.0/libXg/xtbinit.c 638
-	/* nsrc not updated.  This will impact efficiency but not
-	 * correctness, I think.
-	 */
hunk ./9libs-1.0/libXg/xtbinit.c 642
+	/* update nsrc */
+	while (! esrc[nsrc-1].inuse)
+		nsrc--;
}

--#

---------------- BRANCH PRISTINE ----------------:
(note the spaces in the last two lines, the if expression --
well, I don't know if they are really important)

static void
rmsource(int s)
{
	/* nsrc not updated.  This will impact efficiency but not
	 * correctness, I think.
	 */
	esrc[s].inuse = 0;
	esrc[s].size = 0;
	esrc[s].count = 0;
	esrc[s].head = esrc[s].tail = 0;
	esrc[s].type = Tvoid;
	 if (s+1 >= nsrc)
	 	nsrc = s;
}

--#

---------------- BRANCH WORKING ----------------:
(spaces are gone)

static void
rmsource(int s)
{
	/* nsrc not updated.  This will impact efficiency but not
	 * correctness, I think.
	 */
	esrc[s].inuse = 0;
	esrc[s].size = 0;
	esrc[s].count = 0;
	esrc[s].head = esrc[s].tail = 0;
	esrc[s].type = Tvoid;
	if (s+1 >= nsrc)
		nsrc = s;
}

--#

I had also added and then removed a debug printf line just
before the comment in the branch.  This is how the conflict
was marked.

---------------- CONFLICT MARKING ----------------:

static void
rmsource(int s)
{
	/* nsrc not updated.  This will impact efficiency but not
	 * correctness, I think.
	 */
	esrc[s].inuse = 0;
	esrc[s].size = 0;
	esrc[s].count = 0;
	esrc[s].head = esrc[s].tail = 0;
v v v v v v v
	/* update nsrc */
	while (! esrc[nsrc-1].inuse)
	        nsrc--;
*************
	esrc[s].type = Tvoid;
	if (s+1 >= nsrc)
		nsrc = s;
^ ^ ^ ^ ^ ^ ^
}

--#

And this is the merger.

---------------- MERGER ----------------:

[update nsrc in rmsource()
Tommy Pettersson <ptp at lysator.liu.se>**20050202215553] {
merger 0.0 (
hunk ./9libs-1.0/libXg/xtbinit.c 647
- fprintf(stderr,"rmsource\n");
merger 0.0 (
hunk ./9libs-1.0/libXg/xtbinit.c 647
+ fprintf(stderr,"rmsource\n");
hunk ./9libs-1.0/libXg/xtbinit.c 647
-	/* nsrc not updated.  This will impact efficiency but not
-	 * correctness, I think.
-	 */
)
)
merger 0.0 (
hunk ./9libs-1.0/libXg/xtbinit.c 654
+	esrc[s].type = Tvoid;
+	 if (s+1 >= nsrc)
+	 	nsrc = s;
hunk ./9libs-1.0/libXg/xtbinit.c 654
+	/* update nsrc */
+	while (! esrc[nsrc-1].inuse)
+		nsrc--;
)
}

--#

I expected to see a:

v v v v v v v
*************
	/* nsrc not updated.  This will impact efficiency but not
	 * correctness, I think.
	 */
^ ^ ^ ^ ^ ^ ^

or at least something...


-- 
Tommy Pettersson <ptp at lysator.liu.se>




More information about the darcs-devel mailing list