mozext: remove `hg prunerelbranches` command (Bug 1569734) r=smacleod
authorConnor Sheehan <sheehan@mozilla.com>
Wed, 31 Jul 2019 21:08:34 +0000
changeset 7129 ed5808efbfc7415e552a3de12732cabc9c305966
parent 7128 68c646986378a92050e314c5936cc2aa58712cdc
child 7130 ae1aa880be83cf609c13a1e4bf32c6535ac31d42
push id3551
push usercosheehan@mozilla.com
push dateWed, 31 Jul 2019 21:22:35 +0000
treeherderversion-control-tools@5e857d4f3091 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmacleod
bugs1569734
mozext: remove `hg prunerelbranches` command (Bug 1569734) r=smacleod Use the `firefoxtree` extension and the `fxheads` command, and this problem goes away. The solution is much simpler, too. Differential Revision: https://phabricator.services.mozilla.com/D39948
hgext/mozext/__init__.py
hgext/mozext/tests/test-bookmarks-tracking.t
--- a/hgext/mozext/__init__.py
+++ b/hgext/mozext/__init__.py
@@ -702,28 +702,16 @@ def mybookmarks(ui, repo):
 
         if user != me and not bookmark.startswith(prefix):
             continue
 
         ui.write('%-50s %d:%s\n' % (
             bookmark, repo[node].rev(), short(node)))
 
 
-@command('prunerelbranches', [], _('hg prunerelbranches'))
-def prunerelbranches(ui, repo):
-    """Prune release branch references from the local repo.
-
-    Old repos with mozext.refs_as_bookmarks but not
-    mozext.skip_relbranch_bookmarks may have undesired bookmarks pointed to
-    release branches. Running this command will prune release branch bookmarks
-    from this repository.
-    """
-    repo.prune_relbranch_refs()
-
-
 def reject_repo_names_hook(ui, repo, namespace=None, key=None, old=None,
         new=None, **kwargs):
     """prepushkey hook that prevents changes to reserved names.
 
     Names that begin with the name of a repository identifier are rejected.
     """
     if key.lower().startswith(tuple(REPOS.keys())):
         ui.warn('You are not allowed to push tags or bookmarks that share '
@@ -1564,35 +1552,16 @@ def reposetup(ui, repo):
                 ctx = self[rev]
                 bugs = parse_bugs(ctx.description())
                 if bugs:
                     self.changetracker.associate_bugs_with_changeset(bugs,
                         ctx.node())
 
             makeprogress(ui, 'changeset', None)
 
-        def prune_relbranch_refs(self):
-            todelete = [bm for bm in self._bookmarks.keys()
-                        if bm.endswith('RELBRANCH')]
-            with self.wlock(), self.lock():
-                with self.transaction('prunerelbranch') as tr:
-                    for bm in todelete:
-                        ui.warn('Removing bookmark %s\n' % bm)
-
-                    changes = [(bm, None) for bm in todelete]
-                    self._bookmarks.applychanges(self, tr, changes)
-
-                todelete = [ref for ref in self.remoterefs.keys()
-                            if ref.endswith('RELBRANCH')]
-
-                for ref in todelete:
-                    del self.remoterefs[ref]
-
-                self.remoterefs.write()
-
 
     repo.__class__ = remotestrackingrepo
 
     if ui.configbool('mozext', 'reject_pushes_with_repo_names'):
         ui.setconfig('hooks', 'prepushkey.reject_repo_names',
             reject_repo_names_hook)
 
     # Set up a specially named path so reviewboard resolves this repo to
deleted file mode 100644
--- a/hgext/mozext/tests/test-bookmarks-tracking.t
+++ /dev/null
@@ -1,25 +0,0 @@
-  $ cat >> $HGRCPATH <<EOF
-  > [mozext]
-  > headless = True
-  > [extensions]
-  > EOF
-  $ echo "mozext=$(echo $TESTDIR)/hgext/mozext" >> $HGRCPATH
-
-Test prunerelbranches commands works
-
-  $ hg init test
-  $ cd test
-  $ touch foo
-  $ hg commit -A -m 'test foo'
-  adding foo
-  $ hg bookmark release/MOBILE80_2011100517_RELBRANCH
-  $ hg bookmark foobar
-  $ echo 1 > foo
-  $ hg commit -m 'commit on bookmark'
-  $ hg bookmarks
-   * foobar                    1:619600a1d332
-     release/MOBILE80_2011100517_RELBRANCH 0:56eeeaf5261d
-  $ hg prunerelbranches
-  Removing bookmark release/MOBILE80_2011100517_RELBRANCH
-  $ hg bookmarks
-   * foobar                    1:619600a1d332