This isn't a real implementation of phases support. Rather, it's just enough
to avoid the traceback.
Traceback (most recent call last):
File "/usr/local/share/python/hg", line 38, in <module>
mercurial.dispatch.run()
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 28, in run
sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 65, in dispatch
return _runcatch(req)
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 88, in _runcatch
return _dispatch(req)
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 741, in _dispatch
cmdpats, cmdoptions)
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 514, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 831, in _runcommand
return checkargs()
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 802, in checkargs
return cmdfunc()
File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 738, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/usr/local/lib/python2.7/site-packages/mercurial/util.py", line 472, in check
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/mercurial/commands.py", line 3942, in incoming
return hg.incoming(ui, repo, source, opts)
File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 525, in incoming
return _incoming(display, subreporecurse, ui, repo, source, opts)
File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 494, in _incoming
displaychlist(other, chlist, displayer)
File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 524, in display
displayer.show(other[n])
File "/usr/local/lib/python2.7/site-packages/mercurial/cmdutil.py", line 670, in show
self._show(ctx, copies, matchfn, props)
File "/usr/local/lib/python2.7/site-packages/mercurial/cmdutil.py", line 691, in _show
label='log.changeset changeset.%s' % ctx.phasestr())
File "/usr/local/lib/python2.7/site-packages/mercurial/context.py", line 203, in phasestr
return phases.phasenames[self.phase()]
File "/usr/local/lib/python2.7/site-packages/mercurial/context.py", line 201, in phase
return self._repo._phasecache.phase(self._repo, self._rev)
AttributeError: 'overlaychangectx' object has no attribute '_repo'
This should fix a bug introduced by 4f4ab2d which caused all tags to be
duplicated as bookmarks on pull.
Test coverage has been added for pull to allow verifying the fix.
When communicating with the user on push/outgoing, Mercurial doesn't show a
"exporting hg objects to git" message, so we shouldn't. The message has been
changed to be shown if --verbose is specified.
When communicating with the user on push, Mercurial doesn't show much on
success. Currently, Hg-Git shows every changed ref. After this change,
the default output will more closely match Mercurial's regular behavior (no
per-ref output), while changed refs will be shown if --verbose is specified,
and all refs will be shown if --debug is specified.
This changeset adds test coverage for comparing "hg outgoing -B" in normal
Mercurial usage with Hg-Git usage. This didn't match, since previously, gitrepo
didn't provide a meaningful listkeys implementation. Now, it does.
gitrepo now has access to a GitHandler when a localrepo is available. This
handler is used to access the information needed to implement listkeys for
namespaces (currently, only bookmarks) and bookmarks.
A couple of other tests were testing "divergent bookmark" scenarios. These
tests have been updated to filter out the divergent bookmark output, as it isn't
consistent across the supported Mercurial versions.
This change wraps hg.peer to allow for capturing the repo object. It is then
passed in to new gitrepo instanceds. This will be needed to implement later
functionality, such as richer bookmark support using pushkeys.
In the logic that was attempting to handle the case where the local repo doesn't
have any bookmarks, the assumption was being made that tip resolved to a
non-null revision. In the case of a totally empty local repo, however, that
isn't a valid assumption, and resulted in attempting to set the master ref
to None, which broke dulwich.
The "fix", which avoids the traceback and allows the push to complete (though
still do nothing, since in this case there aren't any changes to push), is to
not tweak the refs at all if tip is nullid. Leaving the special capabilities
ref and not adding a master ref appears to be fine in this case.
The output for "hg push" when there were no changes didn't quite match between
Mercurial with and without Hg-Git, so I changed the behavior to bring it into
synch. The existing "creating and sending data" message was changed to be
included if --verbose is specified.
Mercurial has support for including information about the tested versions of
Mercurial for an extension when it detects that an extension has broken. This
change includes the appropriate attribute in the extension.
Mercurial has support for including a link to an issue tracker when it detects
that an extension has broken. This change includes the appropriate attribute
in the extension, pointing it at the issue tracker for the main BitBucket repo.
There was a bug introduced in fa5f235be2cd such that calling hg outgoing on
a Git repository would result in all refs being deleted from the remote
repository (with the possible exception of the currently checked out branch).
It wasn't noticed before because the existing test for outgoing didn't actually
verify the refs on the remote. This changeset fixes the bug, as well as adding
test coverage to allow verifying that the fix works.
When exporting Git commits, verify that the tree and parents objects
exist in the repository before allowing the commit to be exported. If a
tree or parent commit is missing, then the repository is not valid and
the export should not be allowed.
While working on some other tests, I noticed that the push command was returning
exit code 1 on success. This changeset makes hgrepo.push use the same return
code contract as localrepo.push, which makes the exit codes behave as expected.
that mimic a branchname to be maintained on the git side without
a particular suffix - e.g. if the hg repo had a branch "release_05",
and a bookmark created onto it "release_05_bookmark", the branch on the
git side would be named "release_05". When pulling branches back from
git, if an hg named branch of that name exists, the suffix is appended
back onto the name before creating a bookmark on the hg side.
This is strictly so that a git repo can be generated that has the
same "branch names" as an older hg repo that has named branches, and
has had bookmarks added in to mirror the branch names.
This is given the restrictions that
A. hg named branches can never be renamed and B. hg-git only supports
hg bookmarks, not branches
Signed-off-by: Ehsan Akhgari <ehsan.akhgari@gmail.com>
---
I found a number of bugs when I was trying to convert Mozila's hg repository
to git using hg-git. This patch fixes a number of bugs with irregular
author lines present in hg repositories. Git cannot correctly process a
commit object which has a committer or author line in a format that it does
not understand, which makes it not be able to handle the repositories
with have such commit objects.
The added test cases shows the irregular cases that this patch is able to
deal with.
The wrapped version of findoutgoing unconditionally mangled the
keyword arguments, but doesn't do version fixups unless the
remote is a git repository. This change only mangles the argument
list when the remote is a git repository.
Only show importing/exporting messages when there is something
to do. Change "importing Hg objects into Git" to "exporting
hg objects to git" (and lowercase the other direction).
With this patch, attempts to push (or run outgoing) to read-only git URLs
at github return github's helpful error message instead of just saying
the remote end hung up.
Previously, we appended to .hg/localtags on every pull. This meant
that we never deleted refs that disappeared on the remote server, and
the file length grew without bound. Now we use our own file
(.hg/git-remote-refs) and we do prune refs that disappear from the
remote server.
Use an exact match with the ref name ('foo' in 'refs/heads/foo'),
instead of just checking if it ended with '/foo'.
This allows
$ hg pull -r foo
to run successfully on a repo containing the branches
- 'foo',
- 'mine/foo',
- 'theirs/foo'
dulwich recently changed apply_delta() [1] to return lists. Invoke
join() on the output with an empty string, as dulwich does in its
codebase.
[1] git reference: a2709f6 (Return chunks from apply_delta.)
If a git tag is of the annotated-type, the git server sends an
additional line with the SHA-1 the tag dereferences to (eg.
refs/tag/mytag^{}). These aren't "real" tags, so don't store them.
Splice the ref name only once, and don't loop through refs/heads
multiple times.
This changes the order in which hg tags are created; update test output
to reflect this.