changeset 38431:00368bc0a614

merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 21 Jun 2018 09:32:31 -0700
parents 4f885770c4a2 (current diff) 1322ae04d3d7 (diff)
children 4b73f316ba0e
files mercurial/crecord.py mercurial/merge.py tests/test-commit-interactive-curses.t
diffstat 5 files changed, 66 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/manifest.c	Tue Jun 19 13:49:06 2018 -0700
+++ b/mercurial/cext/manifest.c	Thu Jun 21 09:32:31 2018 -0700
@@ -135,12 +135,22 @@
 	return 0;
 }
 
+static void lazymanifest_init_early(lazymanifest *self)
+{
+	self->pydata = NULL;
+	self->lines = NULL;
+	self->numlines = 0;
+	self->maxlines = 0;
+}
+
 static int lazymanifest_init(lazymanifest *self, PyObject *args)
 {
 	char *data;
 	Py_ssize_t len;
 	int err, ret;
 	PyObject *pydata;
+
+	lazymanifest_init_early(self);
 	if (!PyArg_ParseTuple(args, "S", &pydata)) {
 		return -1;
 	}
@@ -668,6 +678,7 @@
 	if (!copy) {
 		goto nomem;
 	}
+	lazymanifest_init_early(copy);
 	copy->numlines = self->numlines;
 	copy->livelines = self->livelines;
 	copy->dirty = false;
@@ -705,6 +716,7 @@
 	if (!copy) {
 		goto nomem;
 	}
+	lazymanifest_init_early(copy);
 	copy->dirty = true;
 	copy->lines = malloc(self->maxlines * sizeof(line));
 	if (!copy->lines) {
--- a/mercurial/crecord.py	Tue Jun 19 13:49:06 2018 -0700
+++ b/mercurial/crecord.py	Thu Jun 21 09:32:31 2018 -0700
@@ -403,7 +403,7 @@
         if fromline != 0:
             if fromlen == 0:
                 fromline -= 1
-            if tolen == 0:
+            if tolen == 0 and toline > 0:
                 toline -= 1
 
         fromtoline = '@@ -%d,%d +%d,%d @@%s\n' % (
--- a/mercurial/merge.py	Tue Jun 19 13:49:06 2018 -0700
+++ b/mercurial/merge.py	Thu Jun 21 09:32:31 2018 -0700
@@ -1150,8 +1150,10 @@
     copied = set(copy.values())
     copied.update(movewithdir.values())
 
-    if '.hgsubstate' in m1:
-        # check whether sub state is modified
+    if '.hgsubstate' in m1 and wctx.rev() is None:
+        # Check whether sub state is modified, and overwrite the manifest
+        # to flag the change. If wctx is a committed revision, we shouldn't
+        # care for the dirty state of the working directory.
         if any(wctx.sub(s).dirty() for s in wctx.substate):
             m1['.hgsubstate'] = modifiednodeid
 
--- a/tests/test-commit-interactive-curses.t	Tue Jun 19 13:49:06 2018 -0700
+++ b/tests/test-commit-interactive-curses.t	Thu Jun 21 09:32:31 2018 -0700
@@ -214,6 +214,14 @@
   @@ -0,0 +1,1 @@
   +hello world
 
+Make file empty
+  $ printf "" > x
+  $ cat <<EOF >testModeCommands
+  > X
+  > EOF
+  $ hg ci -i -m emptify -d "0 0"
+  $ hg update -C '.^' -q
+
 Editing a hunk puts you back on that hunk when done editing (issue5041)
 To do that, we change two lines in a file, pretend to edit the second line,
 exit, toggle the line selected at the end of the edit and commit.
@@ -236,7 +244,7 @@
   > X
   > EOF
   $ printf "printf 'editor ran\n'; exit 0" > editor.sh
-  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "edit hunk" -d "0 0"
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "edit hunk" -d "0 0" -q
   editor ran
   $ hg cat -r . x
   foo
--- a/tests/test-subrepo.t	Tue Jun 19 13:49:06 2018 -0700
+++ b/tests/test-subrepo.t	Thu Jun 21 09:32:31 2018 -0700
@@ -1941,3 +1941,43 @@
   updating to branch default
   abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s")
   [255]
+
+Test convert subrepositories including merge (issue5526):
+
+  $ hg init tconv
+  $ hg convert --config extensions.convert= -q t/s tconv/s
+  $ hg convert --config extensions.convert= -q t/s/ss tconv/s/ss
+  $ hg convert --config extensions.convert= -q t/t tconv/t
+
+ convert shouldn't fail because of pseudo filenode:
+
+  $ hg convert --config extensions.convert= t tconv
+  scanning source...
+  sorting...
+  converting...
+  17 0
+  16 1
+  15 2
+  14 3
+  13 4
+  12 5
+  11 6
+  10 7
+  9 8
+  8 9
+  7 10
+  6 11
+  5 12
+  4 13
+  3 rm2
+  2 phasecheck4
+  1 16
+  0 branch before subrepo add
+
+ converted .hgsubstate should point to valid nodes:
+
+  $ hg up -R tconv 9
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat tconv/.hgsubstate
+  fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
+  60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t