changeset 36978:c479692690ef

merge with stable
author Augie Fackler <augie@google.com>
date Sat, 17 Mar 2018 21:46:17 -0400
parents a82fc3922446 (current diff) ff2370a70fe8 (diff)
children 255f635c3204
files mercurial/cmdutil.py mercurial/hgweb/hgwebdir_mod.py
diffstat 3 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Mar 16 12:10:15 2018 -0700
+++ b/mercurial/cmdutil.py	Sat Mar 17 21:46:17 2018 -0400
@@ -32,6 +32,7 @@
     logcmdutil,
     match as matchmod,
     merge as mergemod,
+    mergeutil,
     obsolete,
     patch,
     pathutil,
@@ -2357,6 +2358,11 @@
             if subs:
                 subrepoutil.writestate(repo, newsubstate)
 
+        # avoid cycle (TODO: should be removed in default branch)
+        from . import merge as mergemod
+        ms = mergemod.mergestate.read(repo)
+        mergeutil.checkunresolved(ms)
+
         filestoamend = set(f for f in wctx.files() if matcher(f))
 
         changes = (len(filestoamend) > 0)
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Mar 16 12:10:15 2018 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sat Mar 17 21:46:17 2018 -0400
@@ -8,6 +8,7 @@
 
 from __future__ import absolute_import
 
+import gc
 import os
 import time
 
@@ -357,8 +358,18 @@
     def run_wsgi(self, req, res):
         profile = self.ui.configbool('profiling', 'enabled')
         with profiling.profile(self.ui, enabled=profile):
-            for r in self._runwsgi(req, res):
-                yield r
+            try:
+                for r in self._runwsgi(req, res):
+                    yield r
+            finally:
+                # There are known cycles in localrepository that prevent
+                # those objects (and tons of held references) from being
+                # collected through normal refcounting. We mitigate those
+                # leaks by performing an explicit GC on every request.
+                # TODO remove this once leaks are fixed.
+                # TODO only run this on requests that create localrepository
+                # instances instead of every request.
+                gc.collect()
 
     def _runwsgi(self, req, res):
         try:
--- a/tests/test-commit-amend.t	Fri Mar 16 12:10:15 2018 -0700
+++ b/tests/test-commit-amend.t	Sat Mar 17 21:46:17 2018 -0400
@@ -415,6 +415,23 @@
   [255]
   $ hg ci -m 'merge'
 
+Refuse to amend if there is a merge conflict (issue5805):
+
+  $ hg up -q foo
+  $ echo c > a
+  $ hg up default -t :fail
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+  $ hg resolve -l
+  U a
+
+  $ hg ci --amend
+  abort: unresolved merge conflicts (see 'hg help resolve')
+  [255]
+
+  $ hg up -qC .
+
 Follow copies/renames:
 
   $ hg mv b c