D11453: log: if there is a merge state, show conflictother for . [WIP]

joerg.sonnenberger (Joerg Sonnenberger) phabricator at mercurial-scm.org
Sat Sep 18 11:51:20 UTC 2021


joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11453

AFFECTED FILES
  i18n/de.po
  i18n/ja.po
  i18n/pt_BR.po
  mercurial/logcmdutil.py
  mercurial/templatekw.py
  tests/test-backout.t
  tests/test-merge7.t
  tests/test-parents.t
  tests/test-shelve.t

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1425,7 +1425,8 @@
   |  summary:     changes to: add A to bars
   |
   | @  changeset:   4:fe451a778c81
-  |/   user:        test
+  |/   merging:     5:f1d5f53e397b
+  |    user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000
   |    summary:     add C to bars
   |
diff --git a/tests/test-parents.t b/tests/test-parents.t
--- a/tests/test-parents.t
+++ b/tests/test-parents.t
@@ -106,6 +106,7 @@
   (branch merge, don't forget to commit)
   $ hg parents c
   changeset:   3:02d851b7e549
+  merging:     4:48cee28d4b4e
   user:        test
   date:        Thu Jan 01 00:00:03 1970 +0000
   summary:     c
diff --git a/tests/test-merge7.t b/tests/test-merge7.t
--- a/tests/test-merge7.t
+++ b/tests/test-merge7.t
@@ -126,6 +126,7 @@
   changeset:   3:50c3a7e29886
   parent:      1:d1e159716d41
   parent:      2:96b70246a118
+  merging:     4:40d11a4173a8
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     Merge 1
diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -89,6 +89,7 @@
   $ hg log -G
   @  changeset:   4:ed99997b793d
   |  tag:         tip
+  |  merging:     1:22cb4f70d813
   |  user:        test
   |  date:        Thu Jan 01 00:00:05 1970 +0000
   |  summary:     ypples
@@ -741,6 +742,7 @@
   $ hg log -G
   @  changeset:   2:b71750c4b0fd
   |  tag:         tip
+  |  merging:     0:a30dd8addae3
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     capital ten
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -125,6 +125,7 @@
         b'files:       %s\n'
         b'instability: %s\n'
         b'manifest:    %s\n'
+        b'merging:     %s\n'
         b'obsolete:    %s\n'
         b'parent:      %s\n'
         b'phase:       %s\n'
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -279,6 +279,7 @@
         self.lastheader = None
         self.footer = None
         self._columns = templatekw.getlogcolumns()
+        self._currentchangeset = repo[b'.']
 
     def flush(self, ctx):
         rev = ctx.rev()
@@ -348,6 +349,13 @@
                 columns[b'parent'] % scmutil.formatchangeid(pctx), label=label
             )
 
+        merging = self._getmerging(ctx)
+        if merging:
+            self.ui.write(
+                columns[b'merging'] % scmutil.formatchangeid(merging),
+                label='log.merging',
+            )
+
         if self.ui.debugflag:
             mnode = ctx.manifestnode()
             if mnode is None:
@@ -425,6 +433,22 @@
 
         self._showpatch(ctx, graphwidth)
 
+    def _getmerging(self, ctx):
+        if ctx != self._currentchangeset:
+            return None
+        from . import mergestate as mergestatemod
+
+        mergestate = mergestatemod.mergestate.read(self.repo)
+        if not mergestate.active():
+            return None
+        try:
+            other = mergestate.otherctx
+        except KeyError:
+            return None
+        if other != ctx:
+            return other
+        return None
+
     def _showobsfate(self, ctx):
         # TODO: do not depend on templater
         tres = formatter.templateresources(self.repo.ui, self.repo)
@@ -520,6 +544,10 @@
                 removed=fm.formatlist(files.removed, name=b'file'),
             )
 
+        merging = self._getmerging(ctx)
+        if merging:
+            fm.data(merging=fm.hexfunc(merging.node()))
+
         verbose = not self.ui.debugflag and self.ui.verbose
         if verbose or b'files' in datahint:
             fm.data(files=fm.formatlist(ctx.files(), name=b'file'))
diff --git a/i18n/pt_BR.po b/i18n/pt_BR.po
--- a/i18n/pt_BR.po
+++ b/i18n/pt_BR.po
@@ -39515,6 +39515,7 @@
 "files:       %s\n"
 "instability: %s\n"
 "manifest:    %s\n"
+"merging:     %s\n"
 "obsolete:    %s\n"
 "parent:      %s\n"
 "phase:       %s\n"
@@ -39533,6 +39534,7 @@
 "arquivos:      %s\n"
 "instabilidade: %s\n"
 "manifesto:     %s\n"
+"merging:       %s\n"
 "obsolescência: %s\n"
 "pai:           %s\n"
 "fase:          %s\n"
diff --git a/i18n/ja.po b/i18n/ja.po
--- a/i18n/ja.po
+++ b/i18n/ja.po
@@ -38206,6 +38206,7 @@
 "files:       %s\n"
 "instability: %s\n"
 "manifest:    %s\n"
+"merging:     %s\n"
 "obsolete:    %s\n"
 "parent:      %s\n"
 "phase:       %s\n"
@@ -38224,6 +38225,7 @@
 "ファイル:     %s\n"
 "不定性:       %s\n"
 "manifest参照: %s\n"
+"merging:      %s\n"
 "廃止:         %s\n"
 "親リビジョン: %s\n"
 "フェーズ:     %s\n"
diff --git a/i18n/de.po b/i18n/de.po
--- a/i18n/de.po
+++ b/i18n/de.po
@@ -23131,6 +23131,7 @@
 "files:       %s\n"
 "instability: %s\n"
 "manifest:    %s\n"
+"merging:     %s\n"
 "obsolete:    %s\n"
 "parent:      %s\n"
 "phase:       %s\n"
@@ -23149,6 +23150,7 @@
 "Dateien:         %s\n"
 "instability:     %s\n"
 "Manifest:        %s\n"
+"Zusammenführen:  %s\n"
 "obsolete:        %s\n"
 "Vorgänger:       %s\n"
 "Phase:           %s\n"



To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list