Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send Mercurial patches to the transplant client for landing #13

Merged

Conversation

mars-f
Copy link
Contributor

@mars-f mars-f commented Jun 21, 2017

When requesting a landing, Construct 'hg export' formatted patches for
the Transplant service client to consume.

Todo

  • Construct the 'Date' patch header
  • Write tests for 'Date' header construction

@mars-f mars-f requested review from purelogiq and zalun June 21, 2017 01:03
Copy link
Contributor

@purelogiq purelogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few quick comments before you rebase on top of zalun's patch. I will do a full review later.

HG_EXPORT_PATCH_TEMPLATE = """# HG changeset patch
# User {author}
# Date {patchdate}
{commitdesc}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is much more that will have to go into getting commit description. It needs the following format:

Bug #: {Revision Title} r={reviewers}

{Revision Summary}
{Phabricator Revision URL ?}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the doc for details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is covered by a number of other story cards.

"""

HG_EXPORT_PATCH_TEMPLATE = """# HG changeset patch
# User {author}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the "Constructing Transplant Patch" doc, this will be more complicated too. We may need to create a Phabricator API extension to expose the patch author emails.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will be a later story card.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed :)


HG_EXPORT_PATCH_TEMPLATE = """# HG changeset patch
# User {author}
# Date {patchdate}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will investigate this and try to get back to you in time :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solved in code, see the patch construction design doc comments. I chose dddddddd +0000 as the format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with with a patch and it works great. You're right in that we will not need the human formatted date!

Patch that I tried via hg import:

# HG changeset patch
# User Israel Madueme <imadueme@mozilla.com>
# Date 1498600861 14400
Bug 123: Add some comments to client.py

diff --git a/client.py b/client.py
--- a/client.py
+++ b/client.py
@@ -1,15 +1,16 @@
 #!/usr/bin/python
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.

 # This is a comment to test diffs
-# This is a very unsafe thing to put in a diff
+# This is a very unsafe thing to put in a diff
+# This is stupid and should be removed
 LIBFFI_DIRS = (('js/ctypes/libffi', 'libffi'),)
 HG_EXCLUSIONS = ['.hg', '.hgignore', '.hgtags']

 CVSROOT_LIBFFI = ':pserver:anoncvs@sources.redhat.com:/cvs/libffi'

 import os
 import sys
 import datetime

Summary:
When requesting a landing, Construct 'hg export' formatted patches for
the Transplant service client to consume.

Bug: 1374701

Differential Revision: https://mozphab.dev.mozaws.net/D8
@mars-f mars-f force-pushed the construct-hg-patches-for-transplant branch from e5c6ad7 to f9d6c63 Compare June 26, 2017 21:57
@mars-f mars-f changed the title WIP Send Mercurial patches to the transplant client for landing Send Mercurial patches to the transplant client for landing Jun 26, 2017
Copy link
Contributor

@purelogiq purelogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to further review


HG_EXPORT_PATCH_TEMPLATE = """# HG changeset patch
# User {author}
# Date {patchdate}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with with a patch and it works great. You're right in that we will not need the human formatted date!

Patch that I tried via hg import:

# HG changeset patch
# User Israel Madueme <imadueme@mozilla.com>
# Date 1498600861 14400
Bug 123: Add some comments to client.py

diff --git a/client.py b/client.py
--- a/client.py
+++ b/client.py
@@ -1,15 +1,16 @@
 #!/usr/bin/python
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.

 # This is a comment to test diffs
-# This is a very unsafe thing to put in a diff
+# This is a very unsafe thing to put in a diff
+# This is stupid and should be removed
 LIBFFI_DIRS = (('js/ctypes/libffi', 'libffi'),)
 HG_EXCLUSIONS = ['.hg', '.hgignore', '.hgtags']

 CVSROOT_LIBFFI = ':pserver:anoncvs@sources.redhat.com:/cvs/libffi'

 import os
 import sys
 import datetime

Copy link
Contributor

@purelogiq purelogiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful :')

@mars-f mars-f merged commit 36a8071 into mozilla-conduit:master Jun 30, 2017
@mars-f mars-f deleted the construct-hg-patches-for-transplant branch June 30, 2017 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants