Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15379509
D14280.id34470.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D14280.id34470.diff
View Options
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -251,6 +251,12 @@
$dict['changes'] = $this->buildChangesList();
+ return $dict + $this->getDiffAuthorshipDict();
+ }
+
+ public function getDiffAuthorshipDict() {
+ $dict = array();
+
$properties = id(new DifferentialDiffProperty())->loadAllWhere(
'diffID = %d',
$this->getID());
diff --git a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
--- a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
+++ b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
@@ -48,6 +48,19 @@
$arg[] = $diff->getStagingRef();
$merge_src = $diff->getStagingRef();
+
+ $dict = $diff->getDiffAuthorshipDict();
+ $author_name = idx($dict, 'authorName');
+ $author_email = idx($dict, 'authorEmail');
+
+ $api_method = 'differential.getcommitmessage';
+ $api_params = array(
+ 'revision_id' => $revision->getID(),
+ );
+
+ $commit_message = id(new ConduitCall($api_method, $api_params))
+ ->setUser($viewer)
+ ->execute();
} else {
throw new Exception(
pht(
@@ -71,6 +84,8 @@
$target));
}
+ $committer_info = $this->getCommitterInfo($operation);
+
$cmd[] = 'git checkout %s';
$arg[] = $merge_dst;
@@ -78,10 +93,12 @@
$arg[] = $merge_src;
$cmd[] = 'git -c user.name=%s -c user.email=%s commit --author %s -m %s';
- $arg[] = 'autocommitter';
- $arg[] = 'autocommitter@example.com';
- $arg[] = 'autoauthor <autoauthor@example.com>';
- $arg[] = pht('(Automerge!)');
+
+ $arg[] = $committer_info['name'];
+ $arg[] = $committer_info['email'];
+
+ $arg[] = "{$author_name} <{$author_email}>";
+ $arg[] = $commit_message;
$cmd[] = 'git push origin -- %s:%s';
$arg[] = 'HEAD';
@@ -95,4 +112,34 @@
$argv);
}
+ private function getCommitterInfo(DrydockRepositoryOperation $operation) {
+ $viewer = $this->getViewer();
+
+ $committer_name = null;
+
+ $author_phid = $operation->getAuthorPHID();
+ $object = id(new PhabricatorObjectQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($author_phid))
+ ->executeOne();
+
+ if ($object) {
+ if ($object instanceof PhabricatorUser) {
+ $committer_name = $object->getUsername();
+ }
+ }
+
+ if (!strlen($committer_name)) {
+ $committer_name = pht('autocommitter');
+ }
+
+ // TODO: Probably let users choose a VCS email address in settings. For
+ // now just make something up so we don't leak anyone's stuff.
+
+ return array(
+ 'name' => $committer_name,
+ 'email' => 'autocommitter@example.com',
+ );
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 9:37 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7406756
Default Alt Text
D14280.id34470.diff (2 KB)
Attached To
Mode
D14280: When landing revisions via repository automation, use better metadata
Attached
Detach File
Event Timeline
Log In to Comment