summaryrefslogtreecommitdiff
path: root/contrib/hg-to-git/hg-to-git.py
AgeCommit message (Collapse)Author
2024-03-20contrib: drop hg-to-git scriptJeff King
The hg-to-git script is full of command injection vulnerabilities against malicious branch and tag names. It's also old and largely unmaintained; the last commit was over 4 years ago, and the last code change before that was from 2013. Users are better off with a modern remote-helper tool like cinnabar or remote-hg. So rather than spending time to fix it, let's just get rid of it. Reported-by: Matthew Rollings <admin@stealthcopter.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-18hg-to-git: make it compatible with both python3 and python2Hervé Beraud
Python 2 is EOL at the end of 2019, many distros and systems now come with python 3 as their default version. Rewrite features used in hg-to-git that are no longer supported in Python 3, in such a way that an updated code can still be usable with Python 2: - print is not a statement; use print() function instead. - dict.has_key(key) is no more; use "key in dict" instead. Signed-off-by: Hervé Beraud <herveberaud.pro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-09Replace Free Software Foundation address in license noticesTodd Zullinger
The mailing address for the FSF has changed over the years. Rather than updating the address across all files, refer readers to gnu.org, as the GNU GPL documentation now suggests for license notices. The mailing address is retained in the full license files (COPYING and LGPL-2.1). The old address is still present in t/diff-lib/COPYING. This is intentional, as the file is used in tests and the contents are not expected to change. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-23hg-to-git: --allow-empty-message in git commitMaurício C Antunes
Do not fail to import mercurial commits with empty commit messages. Signed-off-by: Maurício C Antunes <mauricio.antunes@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-28Add checks to Python scripts for version dependencies.Eric S. Raymond
Signed-off-by: Eric S. Raymond <esr@thyrsus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-24Correct references to /usr/bin/python which does not exist on FreeBSDR. Tyler Ballance
On FreeBSD, Python does not ship as part of the base system but is available via the ports system, which install the binary in /usr/local/bin. Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-12hg-to-git: fix COMMITTER type-oBart Trojanowski
This script passes the author and committer to git-commit via environment variables, but it was missing the seccond T of COMMITTER in a few places. Signed-off-by: Bart Trojanowski <bart@jukie.net> Acked-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-04hg-to-git: don't import the unused popen2 moduleMiklos Vajna
Importing the popen2 module in Python-2.6 results in the "DeprecationWarning: The popen2 module is deprecated. Use the subprocess module." message. The module itself isn't used in fact, so just removing it solves the problem. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06hg-to-git: use git init instead of git init-dbMiklos Vajna
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06hg-to-git: rewrite "git-frotz" to "git frotz"Miklos Vajna
This is not just nice but necessary since git-frotz is no longer in PATH. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06hg-to-git: abort if the project directory is not a hg repoMiklos Vajna
Check the exit code of the first hg command, and abort to avoid a later ValueError exception. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06hg-to-git: avoid raising a string exceptionMiklos Vajna
This fixes the following warning: hg-to-git.py:92: DeprecationWarning: raising a string exception is deprecated Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-26hg-to-git: add --verbose optionJohannes Schindelin
This patch adds an option to make hg-to-git quiet by default. Note: it only suppresses those messages that would be printed when everything was up-to-date. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16hg-to-git: fix parent analysisStelian Pop
Fix a bug in the hg-to-git convertor introduced by commit 1bc7c13af9f936aa80893100120b542338a10bf4: when searching the changeset parents, 'hg log' returns an extra space at the end of the line, which confuses the .split(' ') based tokenizer: Traceback (most recent call last): File "hg-to-git.py", line 123, in <module> hgchildren[mparent] += ( str(cset), ) KeyError: '' Signed-off-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-16hg-to-git: improve popen callsMark Drago
This patch improves all of the popen calls in hg-to-git.py by specifying the template 'hg log' should use instead of calling 'hg log' and grepping for the desired data. Signed-off-by: Mark Drago <markdrago@gmail.com> Acked-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06hg-to-git: handle an empty dir in hg.Junio C Hamano
Mark Drago had a subversion repository which was then converted to hg and now is moving in to git. The first commit in the svn repo was just the creation of the empty directory. This made its way in to the hg repository fine, but converting from hg to git would cause an error. The problem was that hg-to-git.py tries to commit the change, git-commit fails, and then hg-to-git.py tries to checkout the new revision and that fails (because it was not created). This may have only caused an error because it was the first commit in the repository. If an empty directory was added in the middle of the repo somewhere things might have worked out fine. This patch will use the new --allow-empty option to git-commit to record such an "empty" commit, to reproduce the history recorded in hg more faithfully. Tested-by: Mark Drago <markdrago@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-16hg-to-git speedup through selectable repack intervalsMichael Gebetsroither
Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-05Add hg-to-git conversion utility.Stelian Pop
hg-to-git.py is able to convert a Mercurial repository into a git one, and preserves the branches in the process (unlike tailor) hg-to-git.py can probably be greatly improved (it's a rather crude combination of shell and python) but it does already work quite well for me. Features: - supports incremental conversion (for keeping a git repo in sync with a hg one) - supports hg branches - converts hg tags Signed-off-by: Stelian Pop <stelian@popies.net> Signed-off-by: Junio C Hamano <junkio@cox.net>