General ⇒ DVCS Info (Mercurial/CVS) ⇒ Atlassian/Bitbucket ends Mercurial support ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexDVCS Info (Mercurial/CVS)

Atlassian/Bitbucket ends Mercurial support Reply to topic


Atlassian wrote
After much consideration, we've decided to remove Mercurial support from Bitbucket Cloud and the API. Mercurial features and repositories will be officially removed from Bitbucket and its API on June 1, 2020.

Searching for a new provider, like:
  1. codebasehq.com
  2. Phabricator (php)
  3. kallithea-scm.org (python)
  4. redmine.org (ruby)
  5. perforce helix
  6. RhodeCode
  7. own custom

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Wed Aug 21, 2019 1:44 pm; edited 1 time in total


I've made a simple class to communicate with a Mercurial repository.
This might be enough for integration with the projects/debug system?
<?php class Mercurial { protected $path; // of the repository function __construct(string $path) { $path = \rtrim(\realpath($path), '/\\'); if (!\is_dir("{$path}/.hg") || !\is_file("{$path}/.hg/requires")) { throw new \InvalidArgumentException("Path '{$path}' has no Mercurial repository"); } $this->path = $path; } protected function exec(string $cmd) { if (\WINDOWS_OS) { $cmd = 'set HGPLAIN=1 & hg '.$cmd; } else { $cmd = 'HGPLAIN=1 hg '.$cmd; } // HGRCPATH= $descriptorspec = array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), // stdout 2 => array('pipe', 'a') // stderr ); $pipes = array(); $env = array(); $log_file = \sys_get_temp_dir() . '/hg-' . $_SERVER['HTTP_HOST'] . '-' . \microtime(1) . '.log'; if ($log_file) { $descriptorspec[2] = array('file', $log_file, 'a'); } $data = null; $process = \proc_open($cmd, $descriptorspec, $pipes, $this->path, $env); if (\is_resource($process)) { \fclose($pipes[0]); $data = \stream_get_contents($pipes[1]); \fclose($pipes[1]); if (!$log_file) { $error = \stream_get_contents($pipes[2]); \fclose($pipes[2]); } $code = \proc_close($process); if ($log_file && \is_file($log_file)) { $error = \file_get_contents($log_file); \unlink($log_file); } if ($code) { throw new \RuntimeException($error, $code); } } return $data; } public function getAnnotate(string $file) { $file = \escapeshellarg($file); return \json_decode($this->exec("annotate {$file} --template json"), true); } public function getBranches() { return \json_decode($this->exec('branches --template json'), true); } public function getLog(int $limit = 50, int $top_rev = 0) { $revset = ''; if (0 < $limit) { if (0 < $top_rev) { $y = $top_rev - $limit + 1; $revset = "--rev '{$top_rev}:{$y}'"; } else { $revset = "--limit {$limit}"; } } return \json_decode($this->exec("log {$revset} --template json"), true); } public function getPatch(string $rev) { $rev = \escapeshellarg($rev); return $this->exec("diff --change {$rev} --nodates"); // --noprefix } public function getRevision(string $rev, bool $diff = false) { $rev = \escapeshellarg($rev); $diff = $diff ? '--patch' : ''; return \json_decode($this->exec("log --rev {$rev} {$diff} --template json"), true); } public function parseDiff(string $string) { $file = null; $patch = null; $files = array(); foreach (\preg_split('/\\r?\\n/', $string) as $line) { if (!isset($line[0])) { continue; } switch ($line[0]) { case 'd': if ($file) { if ($patch) { $file['patches'][] = $patch; $patch = null; } $files[] = $file; } \preg_match('/-r\\s+([0-9a-f]+)\\s+-r\\s+([0-9a-f]+)\\s+([^\\s]+)/', $line, $line); $file = array( 'name' => $line[3], 'reva' => $line[1], 'revb' => $line[2], 'patches' => array(), ); break; case '@': if ($patch) { $file['patches'][] = $patch; } \preg_match('/^@@\\s+-([0-9]+),([0-9]+)\\s+\\+([0-9]+),([0-9]+)\\s+@@/', $line, $line); $patch = array( 'linea' => $line[1], 'lineb' => $line[3], 'lines' => array(), ); break; case '-': case '+': if (\preg_match('/^(---|\\+\\+\\+)\\s+\\S+/', $line)) { break; } case ' ': $patch['lines'][] = array( \trim($line[0]), \substr($line,1) ); break; } } if ($file) { if ($patch) { $file['patches'][] = $patch; } $files[] = $file; } return $files; } } if (!\is_callable('proc_open')) { throw new \LogicException('The Poodle\SCM\Mercurial class relies on proc_open, which is not enabled.'); }

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Fri Aug 23, 2019 5:18 pm; edited 3 times in total


Ok, i've added the repositories to this server.

Public access: https://dragonflycms.org/scm/
hg clone https://dragonflycms.org/scm/core hg clone https://dragonflycms.org/scm/l10n hg clone https://dragonflycms.org/scm/modules hg clone https://dragonflycms.org/scm/sources

Developer access:
hg clone ssh://hg@dragonflycms.org/core hg clone ssh://hg@dragonflycms.org/l10n hg clone ssh://hg@dragonflycms.org/modules hg clone ssh://hg@dragonflycms.org/sources


You can just edit your /.hg/hgrc file into something like[paths] default = ssh://hg@dragonflycms.org/core bitbucket = ssh://hg@bitbucket.org/dragonflycms/dragonfly-cms

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Sat Aug 24, 2019 7:46 am; edited 12 times in total

All times are UTC


Jump to: