Commit Graph

158 Commits

Author SHA1 Message Date
Augie Fackler
3f40fa1ef5 Merge 2012-11-11 17:12:55 -06:00
Augie Fackler
2e95d380da git_handler: defend against unexported revisions in tag exporting 2012-11-11 15:46:19 -06:00
Augie Fackler
76a939ac4f Merge obsolete marker fix. 2012-10-29 21:34:37 -05:00
David M. Carr
ceacd986b2 overlaychangectx: fix compatibility with mercurial 2.4-rc (no attribute _repo)
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'
2012-10-29 20:16:00 -04:00
David M. Carr
54da2c48f3 listkeys: simplify ref stripping expression
Eliminate a find that would always return 0, based on an example in git_handler
update_hg_bookmarks.
2012-10-28 20:32:42 -04:00
David M. Carr
ee0a3edb54 pull: don't pull tags as bookmarks
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.
2012-10-26 22:46:02 -04:00
Augie Fackler
586391e789 Merge 2012-10-25 23:22:36 -05:00
David M. Carr
deba26ad93 push: suppress "exporting hg objects to git" message
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.
2012-10-25 21:47:44 -04:00
David M. Carr
fb74ae0f84 push: suppress ref output by default
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.
2012-10-25 21:47:36 -04:00
David M. Carr
7168922e8f gitrepo: initial support for listkeys
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.
2012-10-25 20:49:08 -04:00
David M. Carr
7cbc08a5a2 peer: pass localrepo to new gitrepo instances
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.
2012-10-25 19:54:05 -04:00
David M. Carr
92f7dd666e push: fix traceback when pushing empty hg repo to empty git repo (issue #58)
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.
2012-10-25 00:40:35 -04:00
Jordi Gutiérrez Hermoso
8ab8c36d60 git_handler: replace with-statement with try-finally
Python 2.4 does not have a with-statement
2012-10-18 12:25:04 -04:00
Augie Fackler
9f2907f1f1 Merge 2012-10-17 10:59:42 -05:00
Augie Fackler
f8e6ed57b8 git_handler: lazy-load mapping
Loading the mapping was costing about half a second for a user on IRC
on the pidgin repo. There's no reason to load this data aggressively.
2012-10-17 10:50:55 -05:00
David M. Carr
33ac80b524 push: change "no changes" default output to match normal mercurial
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.
2012-10-07 20:11:27 -04:00
David M. Carr
cf59f5739c docs: include testedwith
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.
2012-09-27 22:52:54 -04:00
David M. Carr
37995f7c6c docs: include buglink
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.
2012-09-27 22:42:41 -04:00
David M. Carr
727eff8e96 outgoing: don't delete remote refs
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.
2012-09-27 22:32:01 -04:00
Gregory Szorc
2d6677065b Verify tree and parent objects are in Git repo
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.
2012-09-21 20:26:26 -07:00
Gregory Szorc
2e7c57f121 Precompile author file regular expression 2012-09-21 19:43:50 -07:00
Gregory Szorc
a8e43072e2 Precompile Git progress regular expressions 2012-09-21 19:42:24 -07:00
Gregory Szorc
19caaa42b9 Precompile Git author extra data regular expression 2012-09-21 19:39:53 -07:00
Gregory Szorc
71b136cd70 Precompile Git username sanitizing regular expression 2012-09-21 19:36:57 -07:00
Gregory Szorc
029f0a2090 Precompile Git URI regular expression 2012-09-21 19:32:16 -07:00
Gregory Szorc
7ac8f5932a Optimize get_git_author
Pre-compile regular expression. Prevent extra key lookup in author_map.
2012-09-21 19:28:46 -07:00
David M. Carr
e7b625ba6a docs: update to correctly reflect that local git repositories are supported 2012-09-13 20:57:37 -04:00
David M. Carr
523efe6ee9 outgoing: re-introduce support for outgoing 2012-09-13 18:47:11 -04:00
Augie Fackler
fbc67fee2e Merge master into next. 2012-09-09 16:13:02 -05:00
David M. Carr
1b832796d9 push: state when no changes are found 2012-09-05 23:27:31 -04:00
David M. Carr
050798d918 push: only output updated refs 2012-09-05 23:27:31 -04:00
David M. Carr
fb9384235f push: return 1 if no changes found, 0 if success
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.
2012-09-05 23:27:31 -04:00
Augie Fackler
41c1d684a6 submodules: only use the ordereddict backport if collections.OrderedDict is unavailable 2012-08-28 09:09:01 -05:00
Augie Fackler
b67b731687 git_handler: remove tab character that snuck in 2012-08-28 09:08:22 -05:00
David M. Carr
20a3702adc revsets: add fromgit and gitnode selectors
Support for Hg 1.5.4 was removed, as it doesn't support revsets and is older
than the earliest version we want to put special effort into supporting.
2012-08-22 23:39:45 -04:00
David M. Carr
11cde56154 templatekw: add support for gitnode template keyword 2012-08-22 23:39:45 -04:00
David M. Carr
9e4da6cfb3 help: add additional help topics 2012-08-22 23:39:45 -04:00
Mads Kiilerich
0c4f25ccd3 git_handler: fix safehasattr - hg util is hgutil 2012-08-13 18:56:27 +02:00
Artem Tikhomirov
d87f82457b Subrepos: generate .hgsubstate and .hgsub based on gitlinks and .gitmodules, preserve gitlinks on hg commit export. Tests included. Dependency from PyPI's ordereddict to use OrderedDict 2012-08-06 18:30:33 +02:00
Augie Fackler
15e2601c3a overlaymanifest: add the withflags method introduced in hg change 3f7abfd06d2d 2012-07-26 18:59:19 -05:00
Augie Fackler
e49137e34a girepo: add _capabilities method expected after the peer refactor 2012-07-26 18:58:18 -05:00
Toshi MARUYAMA
2833d729d3 hgrepo: fix _findtags changes on Mercurial 2.2 2012-07-08 16:10:23 +09:00
Artem Tikhomirov
274ecce47c repository in mercurial.repo.py starts with lowercase 2012-07-26 19:01:17 +02:00
Augie Fackler
13504b1f1e gitrepo: correct capitalization of peerrepository 2012-07-19 19:36:57 -05:00
Bryan O'Sullivan
d0a3db710b gitrepo: cope with module/class renames in hg 2.3 2012-07-18 13:16:43 -07:00
Kevin Bullock
5ea6165dba git_handler: fix import_git_objects for Mercurial 2.0+ (issue 36)
This resolves a traceback on pull where hg-git is looking for the
nonexistent repo._tagtypes.
2012-07-04 09:39:23 -05:00
Augie Fackler
27851f0e49 gitrepo: add url() attribute to fix subrepo support 2012-05-12 03:33:19 -05:00
Augie Fackler
62d195c6c8 git_handler: add missing not from hg metadata extraction 2012-04-21 12:21:29 -05:00
Sean Farley
b8476fff7c git_handler: fix line.split error when bad data from a rebase is in the log 2012-03-31 13:55:06 -05:00
Mike Bayer
f764a03014 - add "author file" extension, allows an author translation map
to put more legit author names in the outgoing git repo
2012-02-23 13:49:07 -05:00