← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/remove-new-hg-imports into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/remove-new-hg-imports into lp:launchpad.

Commit message:
Prevent new Mercurial imports from being requested, or branches linked.

Requested reviews:
  Ian Booth (wallyworld)
Related bugs:
  Bug #1063510 in Launchpad itself: "Remove support for Mecurial imports"
  https://bugs.launchpad.net/launchpad/+bug/1063510

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/remove-new-hg-imports/+merge/128617

Backport the code from the main HG removal branch to prevent new HG imports from being created. This part will land first.
-- 
https://code.launchpad.net/~wallyworld/launchpad/remove-new-hg-imports/+merge/128617
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/code/browser/codeimport.py'
--- lib/lp/code/browser/codeimport.py	2012-10-02 23:20:29 +0000
+++ lib/lp/code/browser/codeimport.py	2012-10-09 01:03:21 +0000
@@ -244,18 +244,6 @@
         allow_fragment=False,
         trailing_slash=False)
 
-    hg_repo_url = URIField(
-        title=_("Repo URL"), required=False,
-        description=_(
-            "The URL of the Mercurial repository.  The tip branch will be "
-            "imported."),
-        allowed_schemes=["http", "https"],
-        allow_userinfo=True,
-        allow_port=True,
-        allow_query=False,     # Query makes no sense in Bazaar.
-        allow_fragment=False,  # Fragment makes no sense in Bazaar.
-        trailing_slash=False)  # See http://launchpad.net/bugs/56357.
-
     bzr_branch_url = URIField(
         title=_("Branch URL"), required=False,
         description=_("The URL of the Bazaar branch."),
@@ -342,20 +330,19 @@
         # display them separately in the form.
         soup = BeautifulSoup(self.widgets['rcs_type']())
         fields = soup.findAll('input')
-        [cvs_button, svn_button, git_button, hg_button, bzr_button,
+        [cvs_button, svn_button, git_button, bzr_button,
             empty_marker] = [
                 field for field in fields
                 if field.get('value') in [
-                     'CVS', 'BZR_SVN', 'GIT', 'HG', 'BZR', '1']]
+                     'CVS', 'BZR_SVN', 'GIT', 'BZR', '1']]
+        bzr_button['onclick'] = 'updateWidgets()'
         cvs_button['onclick'] = 'updateWidgets()'
         svn_button['onclick'] = 'updateWidgets()'
         git_button['onclick'] = 'updateWidgets()'
-        hg_button['onclick'] = 'updateWidgets()'
         # The following attributes are used only in the page template.
         self.rcs_type_cvs = str(cvs_button)
         self.rcs_type_svn = str(svn_button)
         self.rcs_type_git = str(git_button)
-        self.rcs_type_hg = str(hg_button)
         self.rcs_type_bzr = str(bzr_button)
         self.rcs_type_emptymarker = str(empty_marker)
 
@@ -368,8 +355,6 @@
             return None, None, data.get('svn_branch_url')
         elif rcs_type == RevisionControlSystems.GIT:
             return None, None, data.get('git_repo_url')
-        elif rcs_type == RevisionControlSystems.HG:
-            return None, None, data.get('hg_repo_url')
         elif rcs_type == RevisionControlSystems.BZR:
             return None, None, data.get('bzr_branch_url')
         else:
@@ -461,9 +446,6 @@
         elif rcs_type == RevisionControlSystems.GIT:
             self._validateURL(
                 data.get('git_repo_url'), field_name='git_repo_url')
-        elif rcs_type == RevisionControlSystems.HG:
-            self._validateURL(
-                data.get('hg_repo_url'), field_name='hg_repo_url')
         elif rcs_type == RevisionControlSystems.BZR:
             self._validateURL(
                 data.get('bzr_branch_url'), field_name='bzr_branch_url')
@@ -561,7 +543,6 @@
         elif self.code_import.rcs_type in (RevisionControlSystems.SVN,
                                            RevisionControlSystems.BZR_SVN,
                                            RevisionControlSystems.GIT,
-                                           RevisionControlSystems.HG,
                                            RevisionControlSystems.BZR):
             self.form_fields = self.form_fields.omit(
                 'cvs_root', 'cvs_module')
@@ -597,7 +578,6 @@
         elif self.code_import.rcs_type in (RevisionControlSystems.SVN,
                                            RevisionControlSystems.BZR_SVN,
                                            RevisionControlSystems.GIT,
-                                           RevisionControlSystems.HG,
                                            RevisionControlSystems.BZR):
             self._validateURL(data.get('url'), self.code_import)
         else:

=== modified file 'lib/lp/code/javascript/tests/test_productseries-setbranch.html'
--- lib/lp/code/javascript/tests/test_productseries-setbranch.html	2012-03-14 04:41:36 +0000
+++ lib/lp/code/javascript/tests/test_productseries-setbranch.html	2012-10-09 01:03:21 +0000
@@ -142,16 +142,6 @@
                       <tr>
                         <td>
                           <label>
-                            <input class="radioType" id="field.rcs_type.5"
-                                   name="field.rcs_type" type="radio" value="HG" disabled="" />
-                            Mercurial
-                          </label>
-                        </td>
-                      </tr>
-
-                      <tr>
-                        <td>
-                          <label>
                             <input class="radioType" id="field.rcs_type.1"
                                    name="field.rcs_type" type="radio" value="CVS"
                                    disabled="" />

=== modified file 'lib/lp/code/javascript/tests/test_productseries_setbranch.js'
--- lib/lp/code/javascript/tests/test_productseries_setbranch.js	2012-09-24 21:53:16 +0000
+++ lib/lp/code/javascript/tests/test_productseries_setbranch.js	2012-10-09 01:03:21 +0000
@@ -38,7 +38,6 @@
            this.cvs = Y.DOM.byId('field.rcs_type.1');
            this.svn = Y.DOM.byId('field.rcs_type.3');
            this.git = Y.DOM.byId('field.rcs_type.4');
-           this.hg = Y.DOM.byId('field.rcs_type.5');
            this.bzr = Y.DOM.byId('field.rcs_type.6');
         },
 
@@ -67,7 +66,6 @@
            check_handler(this.cvs, module.onclick_rcs_type);
            check_handler(this.svn, module.onclick_rcs_type);
            check_handler(this.git, module.onclick_rcs_type);
-           check_handler(this.hg, module.onclick_rcs_type);
            check_handler(this.bzr, module.onclick_rcs_type);
         },
 
@@ -95,8 +93,6 @@
                            'svn button not disabled');
            Y.Assert.isTrue(this.git.disabled,
                            'git button not disabled');
-           Y.Assert.isTrue(this.hg.disabled,
-                           'hg button not disabled');
            Y.Assert.isTrue(this.bzr.disabled,
                            'bzr button not disabled');
         },
@@ -123,8 +119,6 @@
                            'svn button disabled');
            Y.Assert.isFalse(this.git.disabled,
                            'git button disabled');
-           Y.Assert.isFalse(this.hg.disabled,
-                           'hg button disabled');
            Y.Assert.isFalse(this.bzr.disabled,
                            'bzr button disabled');
 
@@ -147,7 +141,6 @@
            module.onclick_branch_type();
            Y.Assert.isFalse(this.repo_url.disabled,
                            'repo_url disabled');
-           this.hg.checked = true;
            module.onclick_rcs_type();
            // The CVS module input is disabled.
            Y.Assert.isTrue(this.cvs_module.disabled,

=== modified file 'lib/lp/code/stories/codeimport/xx-admin-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-admin-codeimport.txt	2011-12-24 17:49:30 +0000
+++ lib/lp/code/stories/codeimport/xx-admin-codeimport.txt	2012-10-09 01:03:21 +0000
@@ -33,13 +33,8 @@
     >>> git_import_location = str(canonical_url(git_import.branch))
     >>> git_import_branch_unique_name = git_import.branch.unique_name
 
-    >>> hg_import = factory.makeProductCodeImport(
-    ...     hg_repo_url="http://hg.example.org/bar";)
-    >>> hg_import_location = str(canonical_url(hg_import.branch))
-    >>> hg_import_branch_unique_name = hg_import.branch.unique_name
-
     >>> package_import = factory.makePackageCodeImport(
-    ...     hg_repo_url="http://hg.example.org/zap";)
+    ...     git_repo_url="http://git.example.org/zap";)
     >>> package_import_location = str(canonical_url(package_import.branch))
     >>> package_import_branch_unique_name = package_import.branch.unique_name
 
@@ -110,15 +105,10 @@
     >>> print_form_fields(import_browser)
     field.url: git://git.example.org/fooix
 
-    >>> import_browser.open(hg_import_location)
-    >>> import_browser.getLink('Edit import source or review import').click()
-    >>> print_form_fields(import_browser)
-    field.url: http://hg.example.org/bar
-
     >>> import_browser.open(package_import_location)
     >>> import_browser.getLink('Edit import source or review import').click()
     >>> print_form_fields(import_browser)
-    field.url: http://hg.example.org/zap
+    field.url: http://git.example.org/zap
 
 
 Editing the import location
@@ -170,16 +160,6 @@
     ...     print extract_text(message)
     The code import has been updated.
 
-Mercurial imports,
-
-    >>> import_browser.open(hg_import_location + '/+edit-import')
-    >>> import_browser.getControl('URL').value = \
-    ...     'http://user:password@xxxxxxxxxxxxxxxxx/bar'
-    >>> import_browser.getControl('Update').click()
-    >>> for message in get_feedback_messages(import_browser.contents):
-    ...     print extract_text(message)
-    The code import has been updated.
-
 and imports targetting source packages.
 
     >>> import_browser.open(package_import_location + '/+edit-import')

=== modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-create-codeimport.txt	2011-10-03 15:35:14 +0000
+++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt	2012-10-09 01:03:21 +0000
@@ -59,7 +59,6 @@
     >>> print_radio_button_field(browser.contents, "rcs_type")
     (*) Bazaar
     ( ) Git
-    ( ) Mercurial
     ( ) Subversion
     ( ) CVS
 
@@ -175,29 +174,6 @@
     The next import is scheduled to run as soon as possible.
 
 
-Requesting a Mercurial import
-=======================
-
-The user is required to enter a project that the import is for,
-a name for the import branch, and a mercurial branch location.
-
-    >>> browser.open("http://code.launchpad.dev/+code-imports/+new";)
-    >>> browser.getControl('Project').value = "firefox"
-    >>> browser.getControl('Branch Name').value = "hg-import"
-    >>> browser.getControl('Mercurial').click()
-    >>> browser.getControl('Repo URL', index=1).value = (
-    ...     "http://example.com/firefox.hg";)
-    >>> browser.getControl('Request Import').click()
-
-When the user clicks continue, the approved import branch is created
-
-    >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))
-    Import Status: Reviewed
-    This branch is an import of the tip branch of the Mercurial repository at
-    http://example.com/firefox.hg.
-    The next import is scheduled to run as soon as possible.
-
-
 Requesting a CVS import
 =======================
 

=== modified file 'lib/lp/code/templates/codeimport-new.pt'
--- lib/lp/code/templates/codeimport-new.pt	2012-03-29 17:37:33 +0000
+++ lib/lp/code/templates/codeimport-new.pt	2012-10-09 01:03:21 +0000
@@ -81,20 +81,6 @@
         <tr>
           <td>
             <label>
-              <input tal:replace="structure view/rcs_type_hg" />
-              Mercurial
-            </label>
-            <table class="importdetails">
-              <tal:widget define="widget nocall:view/widgets/hg_repo_url">
-                <metal:block use-macro="context/@@launchpad_form/widget_row" />
-              </tal:widget>
-            </table>
-          </td>
-        </tr>
-
-        <tr>
-          <td>
-            <label>
               <input tal:replace="structure view/rcs_type_svn" />
               Subversion
             </label>
@@ -145,7 +131,6 @@
                 }
             }
             updateField(form['field.git_repo_url'], rcs_type === 'GIT');
-            updateField(form['field.hg_repo_url'], rcs_type === 'HG');
             updateField(form['field.cvs_root'], rcs_type === 'CVS');
             updateField(form['field.cvs_module'], rcs_type === 'CVS');
             updateField(form['field.svn_branch_url'], rcs_type === 'BZR_SVN');

=== modified file 'lib/lp/registry/browser/tests/productseries-setbranch-view.txt'
--- lib/lp/registry/browser/tests/productseries-setbranch-view.txt	2012-10-08 04:59:10 +0000
+++ lib/lp/registry/browser/tests/productseries-setbranch-view.txt	2012-10-09 01:03:21 +0000
@@ -97,7 +97,7 @@
 --------------------------------
 
 Importing an externally hosted branch can either be a mirror, if a
-Bazaar branch, or an import, if a git, hg, cvs, or svn branch.
+Bazaar branch, or an import, if a git, cvs, or svn branch.
 
 Lots of data are required to create an import.
 
@@ -245,28 +245,6 @@
     >>> print series.branch.name
     suburban-branch
 
-Mercurial branches must use http or https as the scheme.
-
-    >>> series = factory.makeProductSeries(name="malibu", product=product)
-    >>> transaction.commit()
-    >>> form = {
-    ...     'field.branch_type': 'import-external',
-    ...     'field.rcs_type': 'HG',
-    ...     'field.branch_name': 'malibu-branch',
-    ...     'field.branch_owner': team.name,
-    ...     'field.repo_url': 'https://mercurial.com/branch',
-    ...     'field.actions.update': 'Update',
-    ...     }
-    >>> view = create_initialized_view(
-    ...     series, name='+setbranch', principal=driver, form=form)
-    >>> for error in view.errors:
-    ...     print error
-    >>> for notification in view.request.response.notifications:
-    ...     print notification.message
-    Code import created and branch linked to the series.
-    >>> print series.branch.name
-    malibu-branch
-
 CVS branches must use http or https as the scheme and must have the
 CVS module field specified.
 

=== modified file 'lib/lp/registry/stories/productseries/xx-productseries-set-branch.txt'
--- lib/lp/registry/stories/productseries/xx-productseries-set-branch.txt	2012-03-08 19:35:12 +0000
+++ lib/lp/registry/stories/productseries/xx-productseries-set-branch.txt	2012-10-09 01:03:21 +0000
@@ -3,9 +3,9 @@
 
 A product series should have a branch set for it.  The branch can be
 hosted on Launchpad or somewhere else.  Foreign branches can be in
-Bazaar, Git, Mercurial, Subversion, or CVS.  Though internally
-Launchpad treats those scenarios differently we provide a single page
-to the user to set up the branch.
+Bazaar, Git, Subversion, or CVS.  Though internally Launchpad treats those
+scenarios differently we provide a single page to the user to set up the
+branch.
 
 At present, the unified page for setting up the branch is not linked
 from anywhere, so it must be navigated to directly.
@@ -49,7 +49,7 @@
 -----------------------------
 
 An external branch can be linked.  The branch can be a Bazaar branch
-or be a Git, Mercurial, Subversion, or CVS branch.
+or be a Git, Subversion, or CVS branch.
 
 Each of these types must provide the URL of the external repository,
 the branch name to use in Launchpad, and the branch owner.
@@ -102,10 +102,10 @@
 
     >>> browser.open('http://launchpad.dev/firefox/trunk/+setbranch')
     >>> browser.getControl('Import a branch hosted somewhere else').click()
-    >>> browser.getControl('Branch name').value = 'hg-firefox-branch'
-    >>> browser.getControl('Mercurial').click()
+    >>> browser.getControl('Branch name').value = 'git-firefox-branch'
+    >>> browser.getControl('Git').click()
     >>> browser.getControl('Branch URL').value = (
-    ...     'http://hg.example.com/branch')
+    ...     'http://git.example.com/branch')
     >>> browser.getControl('Branch owner').value = ['hwdb-team']
     >>> browser.getControl('Update').click()
     >>> for message in get_feedback_messages(browser.contents):
@@ -116,7 +116,7 @@
     >>> login('test@xxxxxxxxxxxxx')
     >>> firefox_trunk = firefox.getSeries('trunk')
     >>> print firefox_trunk.branch.unique_name
-    ~hwdb-team/firefox/hg-firefox-branch
+    ~hwdb-team/firefox/git-firefox-branch
     >>> print firefox_trunk.branch.owner.name
     hwdb-team
     >>> logout()

=== modified file 'lib/lp/registry/templates/productseries-setbranch.pt'
--- lib/lp/registry/templates/productseries-setbranch.pt	2012-03-10 13:11:43 +0000
+++ lib/lp/registry/templates/productseries-setbranch.pt	2012-10-09 01:03:21 +0000
@@ -86,14 +86,6 @@
 
               <tr>
                 <td>
-                  <label tal:replace="structure view/rcs_type_hg">
-                    Mercurial
-                  </label>
-                </td>
-              </tr>
-
-              <tr>
-                <td>
                   <label tal:replace="structure view/rcs_type_cvs">
                     CVS
                   </label>


Follow ups