Merge "Fix html syntax in gr-diff-preferences"
diff --git a/Documentation/intro-gerrit-walkthrough.txt b/Documentation/intro-gerrit-walkthrough.txt
index 071267a..fcb4de2 100644
--- a/Documentation/intro-gerrit-walkthrough.txt
+++ b/Documentation/intro-gerrit-walkthrough.txt
@@ -182,7 +182,7 @@
 
 Later in the day, Max decides to check on his change and notices Hannah's
 feedback. He opens up the source file and incorporates her feedback. Because
-Max's change includes a change-id, all he has to is follow the typical git
+Max's change includes a change-id, all he has to do is follow the typical git
 workflow for updating a commit:
 
 * Check out the commit
diff --git a/SUBMITTING_PATCHES b/SUBMITTING_PATCHES
index 553ab34..5a82fd9 100644
--- a/SUBMITTING_PATCHES
+++ b/SUBMITTING_PATCHES
@@ -3,6 +3,7 @@
  - Make small logical changes.
  - Provide a meaningful commit message.
  - Make sure all code is under the Apache License, 2.0.
+ - Make sure all commit messages have a Change-Id.
  - Publish your changes for review:
 
    git push https://gerrit.googlesource.com/gerrit HEAD:refs/for/master
@@ -67,6 +68,13 @@
 
   https://gerrit-review.googlesource.com/#/settings/http-password
 
+Ensure you have installed the commit-msg hook that automatically
+generates and inserts a Change-Id line during "git commit".  This can
+be done from the root directory of the local Git repository:
+
+   curl -Lo .git/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg
+   chmod +x .git/hooks/commit-msg
+
 Push your patches over HTTPS to the review server, possibly through
 a remembered remote to make this easier in the future:
 
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.html b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.html
index da57d53..ca94356 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.html
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.html
@@ -29,6 +29,7 @@
 <link rel="import" href="../../shared/gr-label/gr-label.html">
 <link rel="import" href="../../shared/gr-linked-chip/gr-linked-chip.html">
 <link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
+<link rel="import" href="../gr-commit-info/gr-commit-info.html">
 <link rel="import" href="../gr-reviewer-list/gr-reviewer-list.html">
 
 <dom-module id="gr-change-metadata">
@@ -127,6 +128,13 @@
       #externalStyle {
         display: block;
       }
+      .parentList.merge {
+        list-style-type: decimal;
+        padding-left: 1em;
+      }
+      .parentList gr-commit-info {
+        display: inline-block;
+      }
       @media screen and (max-width: 50em), screen and (min-width: 75em) {
         :host {
           display: table;
@@ -225,6 +233,21 @@
           <a href$="[[_computeBranchURL(change.project, change.branch)]]">[[change.branch]]</a>
         </span>
       </section>
+      <section>
+        <span class="title">[[_computeParentsLabel(_currentParents)]]</span>
+        <span class="value">
+          <ol class$="[[_computeParentListClass(_currentParents)]]">
+            <template is="dom-repeat" items="[[_currentParents]]" as="parent">
+              <li>
+                <gr-commit-info
+                    change="[[change]]"
+                    commit-info="[[parent]]"
+                    server-config="[[serverConfig]]"></gr-commit-info>
+              </li>
+            </template>
+          </ol>
+        </span>
+      </section>
       <section class="topic">
         <span class="title">Topic</span>
         <span class="value">
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js
index fb5771c..92763ee 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js
@@ -74,6 +74,11 @@
         type: Boolean,
         value: false,
       },
+
+      _currentParents: {
+        type: Array,
+        computed: '_computeParents(change)',
+      },
     },
 
     behaviors: [
@@ -406,5 +411,22 @@
 
       return rev.uploader;
     },
+
+    _computeParents(change) {
+      if (!change.current_revision ||
+          !change.revisions[change.current_revision] ||
+          !change.revisions[change.current_revision].commit) {
+        return undefined;
+      }
+      return change.revisions[change.current_revision].commit.parents;
+    },
+
+    _computeParentsLabel(parents) {
+      return parents.length > 1 ? 'Parents' : 'Parent';
+    },
+
+    _computeParentListClass(parents) {
+      return parents.length > 1 ? 'parentList merge' : 'parentList';
+    },
   });
 })();
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html
index 53e896b..f6d020e 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html
@@ -318,6 +318,24 @@
       assert.equal(actual, '');
     });
 
+    test('_computeParents', () => {
+      const parents = [{commit: '123', subject: 'abc'}];
+      assert.isUndefined(element._computeParents(
+          {revisions: {456: {commit: {parents}}}}));
+      assert.isUndefined(element._computeParents(
+          {current_revision: '789', revisions: {456: {commit: {parents}}}}));
+      assert.equal(element._computeParents(
+          {current_revision: '456', revisions: {456: {commit: {parents}}}}),
+          parents);
+    });
+
+    test('_computeParentsLabel', () => {
+      const parent = {commit: 'abc123', subject: 'My parent commit'};
+      assert.equal(element._computeParentsLabel([parent]), 'Parent');
+      assert.equal(element._computeParentsLabel([parent, parent]),
+          'Parents');
+    });
+
     test('_showAddTopic', () => {
       assert.isTrue(element._showAddTopic(null, false));
       assert.isTrue(element._showAddTopic({base: {topic: null}}, false));