Commit Graph

1057 Commits

Author SHA1 Message Date
Boris Feld
4a1873b535 configitems: register the 'convert.p4.encoding' config 2017-06-30 03:36:10 +02:00
Saurabh Singh
abf69172aa convert: fix the RevisionSpec import in the bzr module
This import was failing (because its invalid) which was resulting in
the following tests failing with chg running:

 - test-convert-bzr.t
 - test-convert-bzr-directories.t
 - test-convert-bzr-ghosts.t
 - test-convert-bzr-treeroot.t
 - test-convert-bzr-114.t
 - test-convert-bzr-merges.t

This commit fixes the import which in turn fixes the tests.

Test Plan:
Ran the aforementioned tests with and without '--chg' option.

Differential Revision: https://phab.mercurial-scm.org/D936
2017-10-05 00:48:44 +00:00
Augie Fackler
0dc7200e8a convert: remove superfluous pass statements 2017-09-30 07:42:47 -04:00
Yuya Nishihara
c94105ba63 py3: replace str(None) with literal in convcmd.py 2017-09-27 19:08:23 +09:00
Boris Feld
f1a318b57c configitems: register the 'convert.svn.startrev' config 2017-06-30 03:36:46 +02:00
Boris Feld
65dddb9921 configitems: register the 'convert.svn.debugsvnlog' config 2017-06-30 03:36:36 +02:00
Boris Feld
bfd6a094b8 configitems: register the 'convert.skiptags' config 2017-06-30 03:36:28 +02:00
Boris Feld
167f67866c configitems: register the 'convert.p4.startrev' config 2017-06-30 03:36:20 +02:00
Boris Feld
84900c1583 configitems: register the 'convert.localtimezone' config 2017-06-30 03:36:00 +02:00
Boris Feld
cb1096bc89 configitems: register the 'convert.ignoreancestorcheck' config 2017-06-30 03:35:55 +02:00
Boris Feld
1f2741adc0 configitems: register the 'convert.hg.usebranchnames' config 2017-06-30 03:35:48 +02:00
Boris Feld
4b94346048 configitems: register the 'convert.hg.tagsbranch' config 2017-06-30 03:35:38 +02:00
Boris Feld
fc4e98f098 configitems: register the 'convert.hg.startrev' config 2017-06-30 03:35:29 +02:00
Boris Feld
8185f63ed5 configitems: register the 'convert.hg.sourcename' config 2017-06-30 03:35:22 +02:00
Boris Feld
0e74ab2663 configitems: register the 'convert.hg.saverev' config 2017-06-30 03:35:12 +02:00
Boris Feld
4285533e9f configitems: register the 'convert.hg.revs' config 2017-06-30 03:34:58 +02:00
Boris Feld
796bce4006 configitems: register the 'convert.hg.ignoreerrors' config 2017-06-30 03:34:49 +02:00
Boris Feld
5222300c2f configitems: register the 'convert.hg.clonebranches' config 2017-06-30 03:34:45 +02:00
Boris Feld
16cc412230 configitems: register the 'convert.git.skipsubmodules' config 2017-06-30 03:34:32 +02:00
Boris Feld
1d68ca2454 configitems: register the 'convert.git.similarity' config 2017-06-30 03:34:23 +02:00
Boris Feld
66b082d31c configitems: register the 'convert.git.saverev' config 2017-06-30 03:34:14 +02:00
Boris Feld
1f1b9ffd32 configitems: register the 'convert.git.renamelimit' config 2017-06-30 03:34:06 +02:00
Boris Feld
928c7aa1bb configitems: register the 'convert.git.remoteprefix' config 2017-06-30 03:34:00 +02:00
Boris Feld
6621aa529f configitems: register the 'convert.git.findcopiesharder' config 2017-06-30 03:33:51 +02:00
Boris Feld
6186c0bccf configitems: register the 'convert.git.extrakeys' config 2017-06-30 03:33:41 +02:00
Boris Feld
7c75720e99 configitems: register the 'convert.git.committeractions' config 2017-06-30 03:33:29 +02:00
Boris Feld
c19e6a920f configitems: register the 'convert.cvsps.mergeto' config 2017-06-30 03:33:25 +02:00
Boris Feld
ad979210fc configitems: register the 'convert.cvsps.mergefrom' config 2017-06-30 03:33:15 +02:00
Boris Feld
f6e4ab41d9 configitems: register the 'convert.cvsps.fuzz' config 2017-06-30 03:33:06 +02:00
Boris Feld
fc15e4e927 configitems: register the 'convert.cvsps.cache' config
The convert extensions has code a bit all around, but it seems simpler to use a
central declaration of options at the root first.
2017-06-30 03:32:53 +02:00
Yuya Nishihara
dcc07e5503 doctest: use print_function and convert bytes to unicode where needed 2017-09-03 14:56:31 +09:00
Yuya Nishihara
a71f259bd2 doctest: bulk-replace string literals with b'' for Python 3
Our code transformer can't rewrite string literals in docstrings, and I
don't want to make the transformer more complex.
2017-09-03 14:32:11 +09:00
Augie Fackler
e2774d9258 python3: wrap all uses of <exception>.strerror with strtolocal
Our string literals are bytes, and we mostly want to %-format a
strerror into a one of those literals, so this fixes a ton of issues.
2017-08-22 20:03:07 -04:00
Boris Feld
316d61deba bookmark: use 'applychanges' in the convert extension 2017-07-10 17:30:20 +02:00
Boris Feld
1d64a7418f convert: use the new 'phase.registernew' function 2017-07-11 00:59:23 +02:00
FUJIWARA Katsunori
cc2b59230c convert: transcode CVS log messages by specified encoding (issue5597)
Converting from CVS to Mercurial assumes that CVS log messages in "cvs
rlog" output are encoded in UTF-8 (or basic Latin-1). But cvs itself
is usually unaware of encoding of log messages, in practice.

Therefore, if there are commits, of which log message is encoded in
other than UTF-8, log message of corresponded revisions in the
converted repository will be broken.

To avoid such broken log messages, this patch transcodes CVS log
messages by encoding specified via "convert.cvsps.logencoding"
configuration.

This patch accepts multiple encoding for convenience, because
"multiple encoding mixed in a repository" easily occurs. For example,
UTF-8 (recent POSIX), cp932 (Windows), and EUC-JP (legacy POSIX) are
well known encoding for Japanese.
2017-07-11 02:10:04 +09:00
Augie Fackler
48687498f9 convert: remove if False block
This code has never run since its introduction on July 18th,
2007. It's time for it to go.

Differential Revision: https://phab.mercurial-scm.org/D19
2017-07-07 15:08:23 -04:00
Matt Harbison
5eb7c3a833 convert: correct the documentation about whitespace in branchmap branches
Might as well let the users know they can get rid of branch names with spaces.
2017-06-10 02:20:14 -04:00
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Martin von Zweigbergk
c3406ac3db cleanup: use set literals
We no longer support Python 2.6, so we can now use set literals.
2017-02-10 16:56:29 -08:00
David Soria Parra
92f2b90f4d convert: fix the handling of empty changlist descriptions in P4
Empty changelist descriptions are valid in Perforce. If we encounter one of
them we are currently running into an IndexError. In case of empty commit
messages set the commit message to **empty changelist description**, which
follows Perforce terminology.
2017-03-22 14:12:58 -05:00
Yuya Nishihara
dcade16cf7 encoding: factor out unicode variants of from/tolocal()
Unfortunately, these functions will be commonly used on Python 3.
2017-03-13 09:11:08 -07:00
Pierre-Yves David
76c3fb0c64 convert: don't use mutable default argument value
Caught by pylint.
2017-03-14 23:48:08 -07:00
Pierre-Yves David
db602f5625 convert: directly use repo.vfs.join
The 'repo.join' method is about to be deprecated.
2017-03-08 16:51:25 -08:00
Pierre-Yves David
f3a174150b vfs: use 'vfs' module directly in 'hgext.convert'
Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.
2017-03-02 13:32:14 +01:00
Pierre-Yves David
e5cb48ac36 vfs: replace 'scmutil.opener' usage with 'scmutil.vfs'
The 'vfs' class is the first class citizen for years. We remove all usages of
the older API. This will let us remove the old API eventually.
2017-03-02 03:52:36 +01:00
Pulkit Goyal
56031921a5 py3: convert the mode argument of os.fdopen to unicodes (2 of 2) 2017-02-13 22:15:28 +05:30
Gregory Szorc
19ccacb90b convert: remove "replacecommitter" action
As pointed out by Yuya, this action doesn't add much (any?) value.
2017-01-14 10:11:19 -08:00
Gregory Szorc
2fc8eb0c18 convert: config option to control Git committer actions
When converting a Git repository to Mercurial at Mozilla, I encountered
a scenario where I didn't want `hg convert` to automatically add the
"committer: <committer>" line to commit messages. While I can hack around
this by rewriting the Git commit before it is fed into `hg convert`,
I figured it would be a useful knob to control.

This patch introduces a config option that allows lots of control
over the committer value. I initially implemented this as a single
boolean flag to control whether to save the committer message. But
then there was feedback that it would be useful to save the committer
in extra data. While this patch doesn't implement support for saving
in extra data, it does add a mechanism for extending which actions
to take on the committer field. We should be able to easily add
actions to save in extra data.

Some of the implemented features weren't asked for. But I figured they
could be useful. If nothing else they demonstrate the extensibility
of this mechanism.
2017-01-13 23:21:10 -08:00
Gregory Szorc
57ef32586b convert: add config option to control storing original revision
common.commit.__init__ sets saverev=True by default. The side effect
of this is that the hg sink will always set the "convert_revision"
extras key to the commit being converted.

This patch adds a config option to disable this behavior.

While most consumers will want "convert_revision" to be a) written
b) with the exact Git commit that was converted, some have use cases
that prefer otherwise. In my case, I am performing significant
rewrites of a Git repository *before* it is fed into `hg convert`.
I have to do this because `hg convert` does not easily support the kind
of transform I desire, even with extensions. (For the curious, I am
"linearizing" the history of a GitHub repo by removing merge commits
which add little value to the final history. It isn't easy to do this
during `hg convert` because of Mercurial's file copy/rename metadata
requirements.)

In my scenario, my pre-convert transform stores a "convert_revision"
key in the Git commit object containing the original Git commit ID.
I want this original Git commit ID carried forward to Mercurial. By
disabling the setting of this extra during `hg convert` and copying
the value from the Git commit object, I can have the final
"convert_revision" extra key contain the original Git commit ID. An
added test verifies this exact scenario.

This feature could likely be implemented for other VCS sources. But
until someone needs the feature, I'm inclined to hold off implementing.
2016-12-22 23:28:35 -07:00