mirror of
https://github.com/frej/fast-export.git
synced 2026-02-27 06:50:41 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b7ca5aaec | ||
|
|
4227621eed | ||
|
|
bdfc0c08c7 | ||
|
|
001749e69d | ||
|
|
20c22a3110 | ||
|
|
f741bf39f2 | ||
|
|
427663c766 | ||
|
|
056756f193 | ||
|
|
588e03bb23 | ||
|
|
89da4ad8af |
28
.github/contributing.md
vendored
Normal file
28
.github/contributing.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
When submitting a patch make sure the commits in your pull request:
|
||||
|
||||
* Have good commit messages
|
||||
|
||||
Please read Chris Beams' blog post [How to Write a Git Commit
|
||||
Message](https://chris.beams.io/posts/git-commit/) on how to write a
|
||||
good commit message. Although the article recommends at most 50
|
||||
characters for the subject, up to 72 characters are frequently
|
||||
accepted for fast-export.
|
||||
|
||||
* Adhere to good [commit
|
||||
hygiene](http://www.ericbmerritt.com/2011/09/21/commit-hygiene-and-git.html)
|
||||
|
||||
When developing a pull request for hg-fast-export, base your work on
|
||||
the current `master` branch and rebase your work if it no longer can
|
||||
be merged into the current `master` without conflicts. Never merge
|
||||
`master` into your development branch, rebase if your work needs
|
||||
updates from `master`.
|
||||
|
||||
When a pull request is modified due to review feedback, please
|
||||
incorporate the changes into the proper commit. A good reference on
|
||||
how to modify history is in the [Pro Git book, Section
|
||||
7.6](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).
|
||||
|
||||
Please do not submit a pull request if you are not willing to spend
|
||||
the time required to address review comments or revise the patch until
|
||||
it follows the guidelines above. A _take it or leave it_ approach to
|
||||
contributing wastes both your and the maintainer's time.
|
||||
33
README.md
33
README.md
@@ -1,4 +1,4 @@
|
||||
hg-fast-export.(sh|py) - mercurial to git converter using git-fast-import
|
||||
hg-fast-export.sh - mercurial to git converter using git-fast-import
|
||||
=========================================================================
|
||||
|
||||
Legal
|
||||
@@ -167,7 +167,7 @@ defined filter methods in the [dos2unix](./plugins/dos2unix) and
|
||||
[branch_name_in_commit](./plugins/branch_name_in_commit) plugins.
|
||||
|
||||
```
|
||||
commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc, 'revision': revision, 'hg_hash': hg_hash, 'committer': 'committer'}
|
||||
commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc, 'revision': revision, 'hg_hash': hg_hash, 'committer': 'committer', 'extra': extra}
|
||||
|
||||
def commit_message_filter(self,commit_data):
|
||||
```
|
||||
@@ -198,11 +198,15 @@ Notes/Limitations
|
||||
|
||||
hg-fast-export supports multiple branches but only named branches with
|
||||
exactly one head each. Otherwise commits to the tip of these heads
|
||||
within the branch will get flattened into merge commits. Chris J
|
||||
Billington's [hg-export-tool] can help you to handle branches with
|
||||
duplicate heads.
|
||||
Alternatively, you can use the [head2branch plugin](./plugins/head2branch)
|
||||
to create a new named branch from an unnamed head.
|
||||
within the branch will get flattened into merge commits. There are a
|
||||
few options to deal with this:
|
||||
1. Chris J Billington's [hg-export-tool] can help you to handle branches with
|
||||
duplicate heads.
|
||||
2. Use the [head2branch plugin](./plugins/head2branch) to create a new named
|
||||
branch from an unnamed head.
|
||||
3. You can ignore unnamed heads with the `-ignore-unnamed-heads` option, which
|
||||
is appropriate in situations such as the extra heads being close commits
|
||||
(abandoned, unmerged changes).
|
||||
|
||||
hg-fast-export will ignore any files or directories tracked by mercurial
|
||||
called `.git`, and will print a warning if it encounters one. Git cannot
|
||||
@@ -221,8 +225,8 @@ possible to use hg-fast-export on remote repositories
|
||||
Design
|
||||
------
|
||||
|
||||
hg-fast-export.py was designed in a way that doesn't require a 2-pass
|
||||
mechanism or any prior repository analysis: if just feeds what it
|
||||
hg-fast-export was designed in a way that doesn't require a 2-pass
|
||||
mechanism or any prior repository analysis: it just feeds what it
|
||||
finds into git-fast-import. This also implies that it heavily relies
|
||||
on strictly linear ordering of changesets from hg, i.e. its
|
||||
append-only storage model so that changesets hg-fast-export already
|
||||
@@ -258,6 +262,10 @@ hygiene](http://www.ericbmerritt.com/2011/09/21/commit-hygiene-and-git.html)
|
||||
how to modify history is in the [Pro Git book, Section
|
||||
7.6](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History).
|
||||
|
||||
Please do not submit a pull request if you are not willing to spend
|
||||
the time required to address review comments or revise the patch until
|
||||
it follows the guidelines above. A _take it or leave it_ approach to
|
||||
contributing wastes both your and the maintainer's time.
|
||||
|
||||
Frequent Problems
|
||||
=================
|
||||
@@ -301,4 +309,11 @@ Frequent Problems
|
||||
git it looks like you have deleted all files, when in fact they have
|
||||
never been checked out. Just do a checkout of the branch you want.
|
||||
|
||||
* `Error: repository has at least one unnamed head: hg r<N>`
|
||||
|
||||
By design, hg-fast-export cannot deal with extra heads on a branch.
|
||||
There are a few options depending on whether the extra heads are
|
||||
in-use/open or normally closed. See [Notes/Limitations](#noteslimitations)
|
||||
section for more details.
|
||||
|
||||
[hg-export-tool]: https://github.com/chrisjbillington/hg-export-tool
|
||||
|
||||
@@ -294,7 +294,7 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors,
|
||||
brmap[name]=n
|
||||
return n
|
||||
|
||||
(revnode,_,user,(time,timezone),files,desc,branch,_)=get_changeset(ui,repo,revision,authors,encoding)
|
||||
(revnode,_,user,(time,timezone),files,desc,branch,extra)=get_changeset(ui,repo,revision,authors,encoding)
|
||||
if repo[revnode].hidden():
|
||||
return count
|
||||
|
||||
@@ -308,7 +308,7 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors,
|
||||
commit_data = {'branch': branch, 'parents': parents,
|
||||
'author': author, 'desc': desc,
|
||||
'revision': revision, 'hg_hash': hg_hash,
|
||||
'committer': user}
|
||||
'committer': user, 'extra': extra}
|
||||
for filter in plugins['commit_message_filters']:
|
||||
filter(commit_data)
|
||||
branch = commit_data['branch']
|
||||
@@ -493,7 +493,12 @@ def verify_heads(ui,repo,cache,force,ignore_unnamed_heads,branchesmap):
|
||||
sanitized_name=sanitize_name(b,"branch",branchesmap)
|
||||
sha1=get_git_sha1(sanitized_name)
|
||||
c=cache.get(sanitized_name)
|
||||
if sha1!=c:
|
||||
if not c and sha1:
|
||||
stderr_buffer.write(
|
||||
b'Error: Branch [%s] already exists and was not created by hg-fast-export, '
|
||||
b'export would overwrite unrelated branch\n' % b)
|
||||
if not force: return False
|
||||
elif sha1!=c:
|
||||
stderr_buffer.write(
|
||||
b'Error: Branch [%s] modified outside hg-fast-export:'
|
||||
b'\n%s (repo) != %s (cache)\n' % (b, b'<None>' if sha1 is None else sha1, c)
|
||||
@@ -547,7 +552,7 @@ def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile,
|
||||
except AttributeError:
|
||||
tip=len(repo)
|
||||
|
||||
min=int(state_cache.get('tip',0))
|
||||
min=int(state_cache.get(b'tip',0))
|
||||
max=_max
|
||||
if _max<0 or max>tip:
|
||||
max=tip
|
||||
@@ -580,8 +585,8 @@ def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile,
|
||||
for rev in range(min,max):
|
||||
c=export_note(ui,repo,rev,c,authors, encoding, rev == min and min != 0)
|
||||
|
||||
state_cache['tip']=max
|
||||
state_cache['repo']=repourl
|
||||
state_cache[b'tip']=max
|
||||
state_cache[b'repo']=repourl
|
||||
save_cache(tipfile,state_cache)
|
||||
save_cache(mappingfile,mapping_cache)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user