Commit Graph

343 Commits

Author SHA1 Message Date
Jonathan Nieder
6e3872b6a0 hg-fast-export.py: sanitize tildes (~) in branch names
In git-check-ref-format (1), there is the following rule for refnames:

	3. It cannot have ASCII control character (i.e. bytes
	   whose values are lower than \040, or \177 DEL), space,
	   tilde ~, caret ^, colon :, question-mark ?, asterisk *,
	   or open bracket [ anywhere;

and indeed, this rule is enforced by "git fast-import". hg-fast-export
already checked for all of the visible characters listed except for ~
and converted them to underscores. For some reason the tilde was
forgotten. This patch makes good on the omission.

Note that control characters are still left alone.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-06-03 08:49:57 +02:00
Rocco Rutte
d89b42a631 Clarify where 'HEAD' branch name comes from
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-05-30 13:44:07 +02:00
Felipe Zimmerle
cdfdae36c8 hg2git: Replaces space with "_" in branches name
Since space doesn't conform to GIT branches name standards,
it should be replaced or with another character.

Signed-off-by: Felipe Zimmerle <felipe.zimmerle@indt.org.br>
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2008-05-30 13:41:56 +02:00
Rocco Rutte
bc98d2c088 hg-fast-export.py: Cache possibly sanitized branch names
...instead of doing it for every single commit.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-26 17:11:57 +02:00
Rocco Rutte
b200f9f8b3 Merge branch 'fixes'
* fixes:
  hg-fast-import.py: Sanitize ref names
  hg-fast-export.py: Don't attempt to dump revs beyond tip with -m
  hg-fast-export.py: Minor tweaks/cleanup
2007-10-26 14:29:18 +00:00
Rocco Rutte
4cc930807d hg-fast-import.py: Sanitize ref names
At least the opensolaris hg repo has tag names containing '*',
so sanitize all branch and tag names roughly according to the
specs for git-check-ref-format(1).

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-26 16:06:40 +02:00
Rocco Rutte
431c32de6b hg-fast-export.py: Don't attempt to dump revs beyond tip with -m
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-25 15:23:17 +02:00
Rocco Rutte
ec1be3d05f hg-fast-export.py: Minor tweaks/cleanup
Remove some unused variables, generalize dictionary-splitting and make
sure we don't sort filename lists twice (repo.status returns files
sorted already).

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-25 15:21:46 +02:00
Rocco Rutte
258f03a9ba Fix shell substitution typo
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 08:28:41 +00:00
Rocco Rutte
82dccb0ea0 hg-reset.py: Use mangle_key() for load_cache() as hg-fast-export.py does
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 08:28:18 +00:00
Rocco Rutte
ee510bb022 hg-fast-export.py: Rewrite merge logic
Merges were completely broken as they ended up with twice the same
parent in git. Still everything besides gitk seemed to work.

This because of 1) the incorrect assumption that a commit's parent is
the commit exported right before it and 2) some confusion with markes
being saved/loaded/used since git-fast-import doesn't allow for a ":0"
mark to map hg revision 1:1 to marks.

The merge "algorithm" now works like this:

1) If the commit's higher parent (highest hg rev), is not the last
commit exported for a particular branch, we issue a "from" command to
place it on top of it.

2) If the commit's lower parent exists, we issue a "merge" for it.

This is much simpler and seems to produce correct merges in git. And
while I'm at it, make output less confusing by prepending the target
branch name to each line.

The "twice the same parent" bug was discovered by Michele Ballabio on
the git list.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 10:06:58 +02:00
Rocco Rutte
8551771d2b hg2git.py: Allow consumers to modify keys of dicts returned by load_cache()
By default, the key is not changed. This will allow us for fixing up the
off-by-one issue with marks restored using load_cache().

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 09:50:52 +02:00
Rocco Rutte
3d1f111d30 hg2git.py: Use git-rev-parse to get SHA1s instead of reading files below refs/ directly
This should now also properly support packed refs.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 09:48:48 +02:00
Rocco Rutte
fb5cd150a6 hg2git.py: Map 'HEAD', 'default' and '' hg branches to 'master' in git
Also add a note where HEAD is comming from.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 09:44:12 +02:00
Rocco Rutte
4cc1d7cf17 Allow for $PYTHON environment variable specifying python binary to use
Signed-off-by: Rocco Rutte <pdmef@gmx.net>
2007-10-22 09:34:40 +02:00
Scott Lamb
e1aa392c39 This prevents invalid command errors caused by bytes not being flushed to
git-fastimport in the same order as they were written to the buffer.

Signed-off-by: Scott Lamb <slamb@slamb.org>
2007-07-16 01:34:49 -07:00
Simon Hausmann
9f234284a7 Removed git-p4 from fast-export. It has been moved to git.git:contrib/fast-import.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-25 10:34:20 +02:00
Simon Hausmann
ee45a2dc49 Make it possible to specify the HEAD for the internal findUpstreamBranchPoint function.
This isn't used right now in git-p4 but I use it in an external script that loads git-p4 as module.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-22 00:01:57 +02:00
Simon Hausmann
01f691145c Added git-p4 branches command that shows the mapping of perforce depot paths to imported git branches.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-20 23:10:28 +02:00
Simon Hausmann
82f6aacdb7 Warn about conflicting p4 branch mappings and use the first one found.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 15:10:24 +02:00
Simon Hausmann
81313edcc0 Fix the branch mapping detection to be independent from the order of the "p4 branches" output.
Collect "unknown" source branches separately and register them at the end.

Also added a minor speed up to splitFilesIntoBranches by breaking out of the loop through all branches when it's safe.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-17 11:25:59 +02:00
Benjamin Sergeant
6e1d41035f git-p4 fails when cloning a p4 depo.
A perforce command with all the files in the repo is generated to get
all the file content.
Here is a patch to break it into multiple successive perforce command
who uses 4K of parameter max, and collect the output for later.

It works, but not for big depos, because the whole perforce depo
content is stored in memory in P4Sync.run(), and it looks like mine is
bigger than 2 Gigs, so I had to kill the process.

[Simon: I added the bit about using SC_ARG_MAX, as suggested by Han-Wen]

Signed-off-by: Benjamin Sergeant <bsergean@gmail.com>
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-16 22:06:06 +02:00
Simon Hausmann
5339c58a25 Fix initial multi-branch import.
The list of existing p4 branches in git wasn't initialized.
2007-06-16 13:09:21 +02:00
Marius Storm-Olsen
b6abe2d89a Only use double quotes on Windows 2007-06-12 15:27:52 +02:00
Simon Hausmann
46cfe91e74 Fix git-p4 rebase to detect the correct upstream branch instead of unconditionally
always rebasing on top of remotes/p4/master
2007-06-12 14:34:46 +02:00
Simon Hausmann
3f7d065721 Moved the code from git-p4 submit to figure out the upstream branch point
into a separate helper method.
2007-06-12 14:31:59 +02:00
Simon Hausmann
f04a1d52e9 git-p4 submit: Fix missing quotes around p4 commands to make them work with spaces in filenames
Noticed by Alex Riesen
2007-06-11 23:41:41 +02:00
Simon Hausmann
b595271340 Mention remotes/p4/master also in the documentation. 2007-06-11 23:30:23 +02:00
Simon Hausmann
1f1d1fd37d Provide some information for single branch imports where the commits go 2007-06-11 23:28:03 +02:00
Kevin Green
58739b4166 git-p4: check for existence of repo dir before trying to create
When using git-p4 in this manner:

git-p4 clone //depot/path/project myproject

If "myproject" already exists as a dir, but not a valid git repo, it fails
to create the directory.

Signed-off-by: Kevin Green <Kevin.Green@morganstanley.com>
2007-06-11 23:15:38 +02:00
Simon Hausmann
62d7323e48 Write out the options tag in the log message of imports only if we actually have
options
2007-06-11 10:01:58 +02:00
Simon Hausmann
d0b4b5c1ad Fix support for explicit disabling of syncing with the origin 2007-06-11 09:59:27 +02:00
Simon Hausmann
883791be16 Fix depot-paths encoding for multi-path imports (don't split up //depot/path/foo) 2007-06-11 08:54:45 +02:00
Simon Hausmann
753e5e80a0 Fix project name guessing 2007-06-11 08:50:57 +02:00
Simon Hausmann
1bc0c678f0 Fix updating/creating remotes/p4/* heads from origin/p4/* 2007-06-10 10:57:40 +02:00
Simon Hausmann
9689743e30 Fixed the check to make sure to exclude the HEAD symbolic refs when updating
the remotes/p4 branches from origin.
2007-06-10 00:22:30 +02:00
Han-Wen Nienhuys
9003c6a1e6 also strip p4/ from local imports. 2007-06-08 19:31:49 -03:00
Han-Wen Nienhuys
2710e51e06 Merge branch 'master' of git://repo.or.cz/fast-export 2007-06-08 18:19:23 -03:00
Han-Wen Nienhuys
8e26f9c2bb print error message when p4 print fails (eg. due to permission problems) 2007-06-08 18:19:16 -03:00
Simon Hausmann
f4b5d09a6a Only get the expensive branch mapping from the p4 server when not
syncing with the help of an origin remote (which we instead then use
to get new branches from).
2007-06-08 08:49:22 +02:00
Simon Hausmann
59a2926517 Make git-p4 submit detect the correct reference (origin) branch when
working with multi-branch imports.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-07 22:54:32 +02:00
Simon Hausmann
7f182ef1b0 Make clone behave like git clone by default again.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-06-07 21:52:12 +02:00
Marius Storm-Olsen
853e41475e Exclude the HEAD symbolic ref from the list of known branches 2007-06-07 15:28:04 +02:00
Marius Storm-Olsen
275f02aadc Fix single branch import into remotes 2007-06-07 15:13:59 +02:00
Marius Storm-Olsen
553b6a4a99 Fix git-p4 clone (defaultDestination) 2007-06-07 15:08:33 +02:00
Marius Storm-Olsen
b7bf365514 Ensure that the commit message is Windows formated (CRLF) before invoking the editor.
(The default editor on Windows (Notepad) doesn't handle Unix line endings)

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-06-07 14:11:15 +02:00
Simon Hausmann
6ce8e50925 Fix depot-path determination for git-p4 submit 2007-06-07 13:10:20 +02:00
Simon Hausmann
a72cdbe18d Fix git-p4 submit 2007-06-07 13:09:14 +02:00
Simon Hausmann
bf109db2b2 Fix git-p4 rebase 2007-06-07 12:51:03 +02:00
Simon Hausmann
94d5e2bc84 Hack to make the multi-branch import work again with self.depotPaths now that
self.depotPath is gone
2007-06-07 09:41:53 +02:00