Commits

David Carr committed 625352b

snapshot latest submissions

  • Participants
  • Parent commits ab29c1c

Comments (0)

Files changed (10)

fix-push-output.diff

 # HG changeset patch
-# Parent 631c4c3b2fa099c8a0571740459250006d3aad93
-push: produce less output by default
+# Parent 300dba3412542e06751244d558aff49bb4056004
+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,
 per-ref output), while changed refs will be shown if --verbose is specified,
 and all refs will be shown if --debug is specified.
 
-diff -r 631c4c3b2fa0 hggit/git_handler.py
---- a/hggit/git_handler.py	Fri Sep 28 21:00:49 2012 -0400
-+++ b/hggit/git_handler.py	Fri Sep 28 21:48:24 2012 -0400
-@@ -248,7 +248,10 @@
+diff -r 300dba341254 hggit/git_handler.py
+--- a/hggit/git_handler.py	Thu Oct 25 20:49:26 2012 -0400
++++ b/hggit/git_handler.py	Thu Oct 25 21:47:36 2012 -0400
+@@ -279,7 +279,10 @@
          if remote_name and new_refs:
              for ref, new_sha in new_refs.iteritems():
                  if new_sha != old_refs.get(ref):
                                     (remote_name, ref, new_sha[0:8]))
  
              self.update_remote_branches(remote_name, new_refs)
-diff -r 631c4c3b2fa0 tests/test-git-tags.t
---- a/tests/test-git-tags.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-git-tags.t	Fri Sep 28 21:48:24 2012 -0400
+diff -r 300dba341254 tests/test-git-tags.t
+--- a/tests/test-git-tags.t	Thu Oct 25 20:49:26 2012 -0400
++++ b/tests/test-git-tags.t	Thu Oct 25 21:47:36 2012 -0400
 @@ -73,6 +73,5 @@
    pushing to $TESTTMP/gitrepo
    exporting hg objects to git
 -      default::refs/heads/master => GIT:3b7fd1b3
  
    $ cd ..
-diff -r 631c4c3b2fa0 tests/test-hg-author.t
---- a/tests/test-hg-author.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-hg-author.t	Fri Sep 28 21:48:24 2012 -0400
+diff -r 300dba341254 tests/test-hg-author.t
+--- a/tests/test-hg-author.t	Thu Oct 25 20:49:26 2012 -0400
++++ b/tests/test-hg-author.t	Thu Oct 25 21:47:36 2012 -0400
 @@ -56,7 +56,6 @@
    pushing to $TESTTMP/gitrepo
    exporting hg objects to git
  
    $ hg log --graph | egrep -v ': *(not-master|master)'
    @  changeset:   8:d3c51ce68cfd
-diff -r 631c4c3b2fa0 tests/test-hg-branch.t
---- a/tests/test-hg-branch.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-hg-branch.t	Fri Sep 28 21:48:24 2012 -0400
+diff -r 300dba341254 tests/test-hg-branch.t
+--- a/tests/test-hg-branch.t	Thu Oct 25 20:49:26 2012 -0400
++++ b/tests/test-hg-branch.t	Thu Oct 25 21:47:36 2012 -0400
 @@ -59,7 +59,6 @@
    pushing to $TESTTMP/gitrepo
    exporting hg objects to git
  
    $ hg log --graph | $filterhash | egrep -v ': *(not-master|master)'
    @  changeset:   2:05aed681ccb3
-diff -r 631c4c3b2fa0 tests/test-hg-tags.t
---- a/tests/test-hg-tags.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-hg-tags.t	Fri Sep 28 21:48:24 2012 -0400
+diff -r 300dba341254 tests/test-hg-tags.t
+--- a/tests/test-hg-tags.t	Thu Oct 25 20:49:26 2012 -0400
++++ b/tests/test-hg-tags.t	Thu Oct 25 21:47:36 2012 -0400
 @@ -54,8 +54,6 @@
    pushing to $TESTTMP/gitrepo
    exporting hg objects to git
  
    $ hg log --graph | egrep -v ': *(not-master|master)'
    @  changeset:   1:d529e9229f6d
-diff -r 631c4c3b2fa0 tests/test-push.t
---- a/tests/test-push.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-push.t	Fri Sep 28 21:48:24 2012 -0400
+diff -r 300dba341254 tests/test-push.t
+--- a/tests/test-push.t	Thu Oct 25 20:49:26 2012 -0400
++++ b/tests/test-push.t	Thu Oct 25 21:47:36 2012 -0400
 @@ -61,7 +61,6 @@
    pushing to $TESTTMP/gitrepo
    exporting hg objects to git
  
    $ echo % this should fail, no changes to push
    % this should fail, no changes to push
-diff -r 631c4c3b2fa0 tests/test-subrepos.t
---- a/tests/test-subrepos.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-subrepos.t	Fri Sep 28 21:48:24 2012 -0400
+diff -r 300dba341254 tests/test-subrepos.t
+--- a/tests/test-subrepos.t	Thu Oct 25 20:49:26 2012 -0400
++++ b/tests/test-subrepos.t	Thu Oct 25 21:47:36 2012 -0400
 @@ -117,7 +117,6 @@
    pushing to $TESTTMP/gitrepo1
    exporting hg objects to git

gitrepo-support-listkeys.diff

 # HG changeset patch
-# Parent 84852e1209ce2d3de849bf1e339e29e3b59ab0a4
-WIP gitrepo: initial support for listkeys
+# Parent e31954248ffdfa088c8765bac3625e732a27f96b
+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
 tests have been updated to filter out the divergent bookmark output, as it isn't
 consistent across the supported Mercurial versions.
 
-diff -r 84852e1209ce hggit/git_handler.py
---- a/hggit/git_handler.py	Fri Sep 28 21:00:45 2012 -0400
-+++ b/hggit/git_handler.py	Sun Oct 07 19:25:55 2012 -0400
-@@ -928,7 +928,7 @@
+diff --git a/hggit/git_handler.py b/hggit/git_handler.py
+--- a/hggit/git_handler.py
++++ b/hggit/git_handler.py
+@@ -966,7 +966,7 @@
          return new_refs
  
  
          client, path = self.get_transport_and_path(remote_name)
          graphwalker = self.git.get_graph_walker()
          def determine_wants(refs):
-diff -r 84852e1209ce hggit/gitrepo.py
---- a/hggit/gitrepo.py	Fri Sep 28 21:00:45 2012 -0400
-+++ b/hggit/gitrepo.py	Sun Oct 07 19:25:55 2012 -0400
+diff --git a/hggit/gitrepo.py b/hggit/gitrepo.py
+--- a/hggit/gitrepo.py
++++ b/hggit/gitrepo.py
 @@ -1,3 +1,4 @@
 +import os
  from mercurial import util
  
      def url(self):
          return self.path
-@@ -39,6 +50,58 @@
+@@ -39,6 +50,22 @@
          return []
  
      def listkeys(self, namespace):
 +            if handler:
 +                handler.export_commits()
 +                refs = handler.fetch_pack(self.path)
-+                #print 'refs:'
-+                #print refs
 +                reqrefs = refs
-+
 +                convertlist, commits = handler.getnewgitcommits(reqrefs)
-+                #print 'convertlist:'
-+                #print convertlist
-+                #print 'commits:'
-+                #print commits
 +                newcommits = [bin(c) for c in commits]
 +                b = overlayrepo(handler, newcommits, refs)
-+                #print 'moo:'
-+                #print b.node('55b133e1d55801b048c1127b797ea3b12aff2ea9')
-+                #print b.changelog.rev(hex('55b133e1d55801b048c1127b797ea3b12aff2ea9'))
-+                #r[r.find('/', r.find('/')+1)+1:]
 +                stripped_refs = dict([
 +                    (ref[ref.find('/', ref.find('/')+1)+1:], b.node(refs[ref]))
 +                        for ref in refs.keys()
 +                            if ref.find('/') != -1])
-+                #print 'stripped_refs:'
-+                #print stripped_refs
-+                #print 'commits:'
-+                #print commits
-+                #remote_name = self.handler.remote_name(self.path)
-+                #print "remote_name:"
-+                #print remote_name
-+                # TODO DC cleanup or 'default'
-+                # TODO DC test with non-named remote
-+                # TODO DC do I need to fetch new remotes here?  test with never cloned/pulled
-+                #tagfile = self.localrepo.join(os.path.join('git-remote-refs'))
-+                #if os.path.exists(tagfile):
-+                #    tf = open(tagfile, 'rb')
-+                #    tagdata = tf.read().split('\n')
-+                #    td = [line.split(' ', 1) for line in tagdata if line]
-+                #    refs = dict([(name, sha) for sha, name in td])
-+                #    bookmarks = {}
-+                #    for ref, sha in refs.iteritems():
-+                #        if ref.startswith(remote_name + '/'):
-+                #            bookmarks[ref[len(remote_name)+1:]] = sha
-+                #    return bookmarks
-+                #else:
-+                #    return {}
-+                #print "gitrepo returning:"
-+                #print stripped_refs
 +                return stripped_refs
          return {}
  
      def pushkey(self, namespace, key, old, new):
-diff -r 84852e1209ce hggit/overlay.py
---- a/hggit/overlay.py	Fri Sep 28 21:00:45 2012 -0400
-+++ b/hggit/overlay.py	Sun Oct 07 19:25:55 2012 -0400
+diff --git a/hggit/overlay.py b/hggit/overlay.py
+--- a/hggit/overlay.py
++++ b/hggit/overlay.py
 @@ -227,6 +227,12 @@
              return self.handler.repo[n]
          return overlaychangectx(self, n)
      def nodebookmarks(self, n):
          return self.refmap.get(n, [])
  
-diff -r 84852e1209ce tests/test-bookmark-workflow.t
---- a/tests/test-bookmark-workflow.t	Fri Sep 28 21:00:45 2012 -0400
-+++ b/tests/test-bookmark-workflow.t	Sun Oct 07 19:25:55 2012 -0400
+diff --git a/tests/test-bookmark-workflow.t b/tests/test-bookmark-workflow.t
+--- a/tests/test-bookmark-workflow.t
++++ b/tests/test-bookmark-workflow.t
 @@ -109,6 +109,11 @@
    searching for changes
    no changes found
    $ hg push
    pushing to $TESTTMP/gitremoterepo
    searching for changes
-diff -r 84852e1209ce tests/test-outgoing.t
---- a/tests/test-outgoing.t	Fri Sep 28 21:00:45 2012 -0400
-+++ b/tests/test-outgoing.t	Sun Oct 07 19:25:55 2012 -0400
+diff --git a/tests/test-incoming.t b/tests/test-incoming.t
+old mode 100755
+new mode 100644
+--- a/tests/test-incoming.t
++++ b/tests/test-incoming.t
+@@ -152,7 +152,8 @@
+ 
+   $ echo % nothing incoming after pull
+   % nothing incoming after pull
+-  $ hg pull
++"adding remote bookmark" message was added in Mercurial 2.3
++  $ hg pull | grep -v "adding remote bookmark"
+   pulling from $TESTTMP/gitrepo
+   importing git objects into hg
+   (run 'hg heads' to see heads, 'hg merge' to merge)
+diff --git a/tests/test-outgoing.t b/tests/test-outgoing.t
+--- a/tests/test-outgoing.t
++++ b/tests/test-outgoing.t
 @@ -126,7 +126,7 @@
    [255]
    $ echo % let\'s pull and try again
    pulling from */gitrepo (glob)
    importing git objects into hg
    (run 'hg update' to get a working copy)
-diff -r 84852e1209ce tests/test-push.t
---- a/tests/test-push.t	Fri Sep 28 21:00:45 2012 -0400
-+++ b/tests/test-push.t	Sun Oct 07 19:25:55 2012 -0400
+diff --git a/tests/test-pull-after-strip.t b/tests/test-pull-after-strip.t
+old mode 100755
+new mode 100644
+--- a/tests/test-pull-after-strip.t
++++ b/tests/test-pull-after-strip.t
+@@ -114,11 +114,12 @@
+   git commit map cleaned
+   $ echo % pull works after \'hg git-cleanup\'
+   % pull works after 'hg git-cleanup'
+-  $ hg pull -r beta
++"adding remote bookmark" message was added in Mercurial 2.3
++  $ hg pull -r beta | grep -v "adding remote bookmark"
+   pulling from $TESTTMP/gitrepo
+   importing git objects into hg
+   (run 'hg update' to get a working copy)
+-  $ hg log --graph | egrep -v ': *(beta|master)'
++  $ hg log --graph | egrep -v 'bookmark: *(alpha|beta|master)'
+   o  changeset:   2:611948b1ec6a
+   |  tag:         default/beta
+   |  tag:         tip
+diff --git a/tests/test-push.t b/tests/test-push.t
+--- a/tests/test-push.t
++++ b/tests/test-push.t
 @@ -102,7 +102,7 @@
    abort: refs/heads/master changed on the server, please pull and merge before pushing
    [255]

implement_treetracker_for_incremental_tree_calculation

-# HG changeset patch
-# User Gregory Szorc <gregory.szorc@gmail.com>
-# Date 1348422117 25200
-# Node ID 85c4b8e2e129975f400c9810eb9bf6ce6fea4c8b
-# Parent  ef583ac939de39b80aaff2d1d3d9f47bf1a1c9f3
-Implement TreeTracker for incremental tree calculation
-
-This class makes exporting Mercurial changesets to Git much faster.
-
-diff --git a/hggit/git_handler.py b/hggit/git_handler.py
---- a/hggit/git_handler.py
-+++ b/hggit/git_handler.py
-@@ -1,13 +1,12 @@
- import os, math, urllib, re
- import stat, posixpath, StringIO
- 
- from dulwich.errors import HangupException, GitProtocolError, UpdateRefsError
--from dulwich.index import commit_tree
- from dulwich.objects import Blob, Commit, Tag, Tree, parse_timezone, S_IFGITLINK
- from dulwich.pack import create_delta, apply_delta
- from dulwich.repo import Repo
- from dulwich import client
- from dulwich import config as dul_config
- 
- try:
-     from mercurial import bookmarks
-@@ -24,16 +23,18 @@
- from mercurial.node import hex, bin, nullid
- from mercurial import context, util as hgutil
- from mercurial import error
- 
- import _ssh
- import util
- from overlay import overlayrepo
- 
-+from .hg2git import TreeTracker
-+
- RE_GIT_AUTHOR = re.compile('^(.*?) ?\<(.*?)(?:\>(.*))?$')
- 
- RE_GIT_SANITIZE_AUTHOR = re.compile('[<>\n]')
- 
- RE_GIT_AUTHOR_EXTRA = re.compile('^(.*?)\ ext:\((.*)\) <(.*)\>$')
- 
- # Test for git:// and git+ssh:// URI.
- # Support several URL forms, including separating the
-@@ -323,32 +324,35 @@
-     def export_git_objects(self):
-         self.init_if_missing()
- 
-         nodes = [self.repo.lookup(n) for n in self.repo]
-         export = [node for node in nodes if not hex(node) in self._map_hg]
-         total = len(export)
-         if total:
-             self.ui.status(_("exporting hg objects to git\n"))
-+
-+        tracker = TreeTracker(self.repo)
-+
-         for i, rev in enumerate(export):
-             util.progress(self.ui, 'exporting', i, total=total)
-             ctx = self.repo.changectx(rev)
-             state = ctx.extra().get('hg-git', None)
-             if state == 'octopus':
-                 self.ui.debug("revision %d is a part "
-                               "of octopus explosion\n" % ctx.rev())
-                 continue
--            self.export_hg_commit(rev)
-+            self.export_hg_commit(rev, tracker)
-         util.progress(self.ui, 'importing', None, total=total)
- 
- 
-     # convert this commit into git objects
-     # go through the manifest, convert all blobs/trees we don't have
-     # write the commit object (with metadata info)
--    def export_hg_commit(self, rev):
-+    def export_hg_commit(self, rev, tracker):
-         self.ui.note(_("converting revision %s\n") % hex(rev))
- 
-         oldenc = self.swap_out_encoding()
- 
-         ctx = self.repo.changectx(rev)
-         extra = ctx.extra()
- 
-         commit = Commit()
-@@ -390,17 +394,21 @@
- 
-                 commit.parents.append(git_sha)
- 
-         commit.message = self.get_git_message(ctx)
- 
-         if 'encoding' in extra:
-             commit.encoding = extra['encoding']
- 
--        tree_sha = commit_tree(self.git.object_store, self.iterblobs(ctx))
-+        for obj in tracker.update_changeset(ctx):
-+            self.git.object_store.add_object(obj)
-+
-+        tree_sha = tracker.root_tree_sha
-+
-         if tree_sha not in self.git.object_store:
-             raise hgutil.Abort(_('Tree SHA-1 not present in Git repo: %s' %
-                 tree_sha))
- 
-         commit.tree = tree_sha
- 
-         self.git.object_store.add_object(commit)
-         self.map_set(commit.id, ctx.hex())
-@@ -536,53 +544,16 @@
-                 add_extras = True
-                 extra_message += "extra : " + key + " : " +  urllib.quote(value) + "\n"
- 
-         if add_extras:
-             message += "\n--HG--\n" + extra_message
- 
-         return message
- 
--    def iterblobs(self, ctx):
--        if '.hgsubstate' in ctx:
--            hgsub = util.OrderedDict()
--            if '.hgsub' in ctx:
--                hgsub = util.parse_hgsub(ctx['.hgsub'].data().splitlines())
--            hgsubstate = util.parse_hgsubstate(ctx['.hgsubstate'].data().splitlines())
--            for path, sha in hgsubstate.iteritems():
--                try:
--                    if path in hgsub and not hgsub[path].startswith('[git]'):
--                        # some other kind of a repository (e.g. [hg])
--                        # that keeps its state in .hgsubstate, shall ignore
--                        continue
--                    yield path, sha, S_IFGITLINK
--                except ValueError:
--                    pass
--
--        for f in ctx:
--            if f == '.hgsubstate' or f == '.hgsub':
--                continue
--            fctx = ctx[f]
--            blobid = self.map_git_get(hex(fctx.filenode()))
--
--            if not blobid:
--                blob = Blob.from_string(fctx.data())
--                self.git.object_store.add_object(blob)
--                self.map_set(blob.id, hex(fctx.filenode()))
--                blobid = blob.id
--
--            if 'l' in ctx.flags(f):
--                mode = 0120000
--            elif 'x' in ctx.flags(f):
--                mode = 0100755
--            else:
--                mode = 0100644
--
--            yield f, blobid, mode
--
-     def getnewgitcommits(self, refs=None):
-         self.init_if_missing()
- 
-         # import heads and fetched tags as remote references
-         todo = []
-         done = set()
-         convert_list = {}
- 
-diff --git a/hggit/hg2git.py b/hggit/hg2git.py
-new file mode 100644
---- /dev/null
-+++ b/hggit/hg2git.py
-@@ -0,0 +1,205 @@
-+# This file contains code dealing specifically with converting Mercurial
-+# repositories to Git repositories. Code in this file is meant to be a generic
-+# library and should be usable outside the context of hg-git or an hg command.
-+
-+import os
-+import stat
-+
-+from dulwich.objects import Blob
-+from dulwich.objects import S_IFGITLINK
-+from dulwich.objects import TreeEntry
-+from dulwich.objects import Tree
-+
-+from mercurial import error as hgerror
-+from mercurial.node import nullrev
-+
-+from . import util
-+
-+class TreeTracker(object):
-+    """Tracks Git tree objects across Mercurial revisions.
-+
-+    The purpose of this class is to facilitate Git tree export that is more
-+    optimal than brute force. The tree calculation part of this class is
-+    essentially a reimplementation of dulwich.index.commit_tree. However, since
-+    our implementation reuses Tree instances and only recalculates SHA-1 when
-+    things change, we are much more efficient.
-+
-+    Callers instantiate this class against a mercurial.localrepo instance. They
-+    then associate the tracker with a specific changeset by calling
-+    update_changeset(). That function emits Git objects that need to be
-+    exported to a Git repository. Callers then typically obtain the
-+    root_tree_sha and use that as part of assembling a Git commit.
-+    """
-+
-+    def __init__(self, hg_repo):
-+        self._hg = hg_repo
-+        self._rev = nullrev
-+        self._dirs = {}
-+        self._blob_cache = {}
-+
-+    @property
-+    def root_tree_sha(self):
-+        return self._dirs[''].id
-+
-+    def update_changeset(self, ctx):
-+        """Set the tree to track a new Mercurial changeset.
-+
-+        This is a generator of dulwich Git objects. Each returned object can be
-+        added to a Git store via add_object(). Some objects may already exist
-+        in the Git repository. Emitted objects are either Blob or Tree
-+        instances.
-+
-+        Emitted objects are those that have changed since the last call to
-+        update_changeset.
-+        """
-+        # In theory we should be able to look at changectx.files(). This is
-+        # *much* faster. However, it may not be accurate, especially with older
-+        # repositories, which may not record things like deleted files
-+        # explicitly in the manifest (which is where files() gets its data).
-+        # The only reliable way to get the full set of changes is by looking at
-+        # the full manifest. And, the easy way to compare two manifests is
-+        # localrepo.status().
-+
-+        # The other members of status are only relevant when looking at the
-+        # working directory.
-+        modified, added, removed = self._hg.status(self._rev, ctx.rev())[0:3]
-+
-+        for path in sorted(removed, key=len, reverse=True):
-+            d = os.path.dirname(path)
-+            tree = self._dirs.get(d, Tree())
-+
-+            del tree[os.path.basename(path)]
-+
-+            if not len(tree):
-+                self._remove_tree(d)
-+                continue
-+
-+            self._dirs[d] = tree
-+
-+        for path in sorted(set(modified) | set(added), key=len, reverse=True):
-+            if path == '.hgsubstate':
-+                self._handle_subrepos(ctx)
-+                continue
-+
-+            if path == '.hgsub':
-+                continue
-+
-+            d = os.path.dirname(path)
-+            tree = self._dirs.get(d, Tree())
-+
-+            fctx = ctx[path]
-+
-+            entry, blob = TreeTracker.tree_entry(fctx, self._blob_cache)
-+            if blob is not None:
-+                yield blob
-+
-+            tree.add(*entry)
-+            self._dirs[d] = tree
-+
-+        for obj in self._populate_tree_entries():
-+            yield obj
-+
-+        self._rev = ctx.rev()
-+
-+    def _remove_tree(self, path):
-+        try:
-+            del self._dirs[path]
-+        except KeyError:
-+            return
-+
-+        # Now we traverse up to the parent and delete any references.
-+        if path == '':
-+            return
-+
-+        basename = os.path.basename(path)
-+        parent = os.path.dirname(path)
-+        while True:
-+            tree = self._dirs.get(parent, None)
-+
-+            # No parent entry. Nothing to remove or update.
-+            if tree is None:
-+                return
-+
-+            try:
-+                del tree[basename]
-+            except KeyError:
-+                return
-+
-+            if len(tree):
-+                return
-+
-+            # The parent tree is empty. Se, we can delete it.
-+            del self._dirs[parent]
-+
-+            if parent == '':
-+                return
-+
-+            basename = os.path.basename(parent)
-+            parent = os.path.dirname(parent)
-+
-+    def _populate_tree_entries(self):
-+        if '' not in self._dirs:
-+            self._dirs[''] = Tree()
-+
-+        # Fill in missing directories.
-+        for path in self._dirs.keys():
-+            parent = os.path.dirname(path)
-+
-+            while parent != '':
-+                parent_tree = self._dirs.get(parent, None)
-+
-+                if parent_tree is not None:
-+                    break
-+
-+                self._dirs[parent] = Tree()
-+                parent = os.path.dirname(parent)
-+
-+        # TODO only emit trees that have been modified.
-+        for d in sorted(self._dirs.keys(), key=len, reverse=True):
-+            tree = self._dirs[d]
-+            yield tree
-+
-+            if d == '':
-+                continue
-+
-+            parent_tree = self._dirs[os.path.dirname(d)]
-+            parent_tree[os.path.basename(d)] = (stat.S_IFDIR, tree.id)
-+
-+    def _handle_subrepos(self, ctx):
-+        substate = util.parse_hgsubstate(ctx['.hgsubstate'].data().splitlines())
-+        sub = util.OrderedDict()
-+
-+        if '.hgsub' in ctx:
-+            sub = util.parse_hgsub(ctx['.hgsub'].data().splitlines())
-+
-+        for path, sha in substate.iteritems():
-+            # Ignore non-Git repositories keeping state in .hgsubstate.
-+            if path in sub and not sub[path].startswith('[git]'):
-+                continue
-+
-+            d = os.path.dirname(path)
-+            tree = self._dirs.get(d, Tree())
-+            tree.add(os.path.basename(path), S_IFGITLINK, sha)
-+            self._dirs[d] = tree
-+
-+    @staticmethod
-+    def tree_entry(fctx, blob_cache):
-+        blob_id = blob_cache.get(fctx.filenode(), None)
-+        blob = None
-+
-+        if blob_id is None:
-+            blob = Blob.from_string(fctx.data())
-+            blob_id = blob.id
-+            blob_cache[fctx.filenode()] = blob_id
-+
-+        flags = fctx.flags()
-+
-+        if 'l' in flags:
-+            mode = 0120000
-+        elif 'x' in flags:
-+            mode = 0100755
-+        else:
-+            mode = 0100644
-+
-+        return (TreeEntry(os.path.basename(fctx.path()), mode, blob_id), blob)
-+
-
--- 
-You received this message because you are subscribed to the Google Groups "hg-git" group.
-To post to this group, send email to hg-git@googlegroups.com.
-To unsubscribe from this group, send email to hg-git+unsubscribe@googlegroups.com.
-For more options, visit this group at http://groups.google.com/group/hg-git?hl=en.
-

limit-push-scope.diff

 # HG changeset patch
-# Parent 53041c4177c012d01767f832e483f800bb722568
+# Parent dfb64719d3ee44f629db52380d85a60a1fd9f66f
 WIP: push: only update bookmarks already on remote unless -B specified
 
-diff -r 53041c4177c0 -r d721c486cd43 hggit/__init__.py
---- a/hggit/__init__.py	Fri Sep 28 21:48:24 2012 -0400
-+++ b/hggit/__init__.py	Sun Sep 30 12:03:59 2012 -0400
+diff -r dfb64719d3ee hggit/__init__.py
+--- a/hggit/__init__.py	Thu Oct 25 21:47:44 2012 -0400
++++ b/hggit/__init__.py	Thu Oct 25 23:26:24 2012 -0400
 @@ -97,6 +97,13 @@
  if getattr(hg, 'addbranchrevs', False):
      extensions.wrapfunction(hg, 'addbranchrevs', safebranchrevs)
  def extsetup():
      templatekw.keywords.update({'gitnode': gitnodekw})
      revset.symbols.update({
-diff -r 53041c4177c0 -r d721c486cd43 hggit/git_handler.py
---- a/hggit/git_handler.py	Fri Sep 28 21:48:24 2012 -0400
-+++ b/hggit/git_handler.py	Sun Sep 30 12:03:59 2012 -0400
-@@ -241,6 +241,8 @@
+diff -r dfb64719d3ee hggit/git_handler.py
+--- a/hggit/git_handler.py	Thu Oct 25 21:47:44 2012 -0400
++++ b/hggit/git_handler.py	Thu Oct 25 23:26:24 2012 -0400
+@@ -272,6 +272,8 @@
              raise hgutil.Abort(_("git remote error: ") + str(e))
  
      def push(self, remote, revs, force):
-+        print "passed in bookmarks:"
-+        print self.repo._push_bookmarks
++        #print "passed in bookmarks:"
++        #print self.repo._push_bookmarks
          self.export_commits()
          old_refs, new_refs = self.upload_pack(remote, revs, force)
          remote_name = self.remote_name(remote)
-@@ -833,13 +835,22 @@
+@@ -869,13 +871,34 @@
      ## PACK UPLOADING AND FETCHING
  
      def upload_pack(self, remote, revs, force):
-+        print "upload packs revs in:"
-+        print revs
++        #print "upload packs revs in:"
++        #print revs
          client, path = self.get_transport_and_path(remote)
          old_refs = {}
          def changed(refs):
-+            print "upload packs refs in:"
-+            print refs
++            #print "upload packs refs in:"
++            #print refs
              old_refs.update(refs)
-             to_push = revs or set(self.local_heads().values() + self.tags.values())
-+            print "local_heads:"
-+            print self.local_heads()
-+            print "tags"
-+            print self.tags
-+            print "to_push:"
-+            print to_push
+-            to_push = revs or set(self.local_heads().values() + self.tags.values())
++            remote_bms = [ref[ref.find('/', ref.find('/')+1)+1:]
++                for ref in refs.keys()
++                    if ref.find('/') != -1]
++            spec_bms = getattr(self.repo, '_push_bookmarks', [])
++            sync_bms = spec_bms + remote_bms
++            heads = self.local_heads()
++            bm_revs = []
++            for bm in heads:
++                if bm in sync_bms:
++                    bm_revs.append(heads[bm])
++            to_push = revs or set(bm_revs + self.tags.values())
++            #print to_push
++            #to_push = revs or set(self.local_heads().values() + self.tags.values())
++            #print "local_heads:"
++            #print self.local_heads()
++            #print "tags"
++            #print self.tags
++            #print "to_push:"
++            #print to_push
              return self.get_changed_refs(refs, to_push, force)
 -
          genpack = self.git.object_store.generate_pack_contents
          try:
              self.ui.status(_("searching for changes\n"))
-@@ -850,6 +861,7 @@
+@@ -886,6 +909,14 @@
              raise hgutil.Abort(_("git remote error: ") + str(e))
  
      def get_changed_refs(self, refs, revs, force):
-+        print "entering get_changed_refs"
++        #print revs
++        #remote_bms = [ref[ref.find('/', ref.find('/')+1)+1:]
++        #    for ref in refs.keys()
++        #        if ref.find('/') != -1]
++        #spec_bms = getattr(self.repo, '_push_bookmarks', [])
++        #sync_bms = spec_bms + remote_bms
++        #print sync_bms
++        #print "entering get_changed_refs"
          new_refs = refs.copy()
  
          #The remote repo is empty and the local one doesn't have bookmarks/tags
-@@ -927,6 +939,8 @@
+@@ -908,6 +939,7 @@
+                 labels = lambda c: ctx.tags() + [
+                                 fltr for fltr, bm
+                                 in self._filter_for_bookmarks(ctx.bookmarks())
++                                #if bm in sync_bms
+                             ]
+             else:
+                 labels = lambda c: ctx.tags()
+@@ -915,6 +947,8 @@
+ 
+             heads = [t for t in prep(labels(ctx)) if t in self.local_heads()]
+             tags = [t for t in prep(labels(ctx)) if t in self.tags]
++            #print heads
++            #print tags
+ 
+             if not (heads or tags):
+                 raise hgutil.Abort("revision %s cannot be pushed since"
+@@ -965,6 +999,8 @@
                  else:
                      raise hgutil.Abort("%s changed on the server, please pull "
                                         "and merge before pushing" % ref)
-+        print "new_refs:"
-+        print new_refs
++        #print "new_refs:"
++        #print new_refs
  
          return new_refs
  
-diff -r 53041c4177c0 -r d721c486cd43 tests/test-bookmark-workflow.t
---- a/tests/test-bookmark-workflow.t	Fri Sep 28 21:48:24 2012 -0400
-+++ b/tests/test-bookmark-workflow.t	Sun Sep 30 12:03:59 2012 -0400
-@@ -179,3 +179,81 @@
+diff -r dfb64719d3ee hggit/gitrepo.py
+--- a/hggit/gitrepo.py	Thu Oct 25 21:47:44 2012 -0400
++++ b/hggit/gitrepo.py	Thu Oct 25 23:26:24 2012 -0400
+@@ -69,6 +69,9 @@
+         return {}
+ 
+     def pushkey(self, namespace, key, old, new):
++        if namespace == 'bookmarks':
++            # updates have already happened in push
++            return True
+         return False
+ 
+     # used by incoming in hg <= 1.6
+diff -r dfb64719d3ee tests/test-bookmark-workflow.t
+--- a/tests/test-bookmark-workflow.t	Thu Oct 25 21:47:44 2012 -0400
++++ b/tests/test-bookmark-workflow.t	Thu Oct 25 23:26:24 2012 -0400
+@@ -179,3 +179,132 @@
    searching for changed bookmarks
       b2                        3442585be8a6
    $ cd ..
 +    0 3442585be8a6 "add alpha" bookmarks: []
 +  $ cd ..
 +  $ cd hggitlocalrepo
++XXX broken?  wrong output
 +  $ hg push
 +  pushing to $TESTTMP/gitremoterepo
 +  searching for changes
-+  no changes found
-+  updating bookmark b1
-+  [1]
 +  $ cd ../gitremoterepo
 +  $ gitstate
 +    55b133e "add delta" refs: (master)
 +    7eeab2e "add alpha" refs:
 +  $ cd ..
 +
++Calling default push with a changeset to push, still shouldn't share new
++bookmarks
 +  $ cd purehglocalrepo
 +  $ hg update master -q
 +  $ echo delta2 >> delta
 +  added 1 changesets with 1 changes to 1 files
 +  updating bookmark master
 +  $ hgstate -R ../hgremoterepo
++    4 9a3af9d5e48d "append delta2" bookmarks: [master]
++    3 fc2664cac217 "add delta" bookmarks: []
++    2 d85ced7ae9d6 "add gamma" bookmarks: [b1]
++    1 7bcd915dc873 "add beta" bookmarks: []
++    0 3442585be8a6 "add alpha" bookmarks: []
 +  $ cd ..
 +  $ cd hggitlocalrepo
 +  $ hg update master -q
 +    0 3442585be8a6 "add alpha" bookmarks: [b2]
 +  $ hg outgoing --template "{rev}:{node|short} {bookmarks} {tags} \"{desc}\"\n"
 +  comparing with $TESTTMP/gitremoterepo
-+  exporting hg objects to git
 +  searching for changes
 +  4:9a3af9d5e48d master tip "append delta2"
++XXX broken
 +  $ hg push
 +  pushing to $TESTTMP/gitremoterepo
 +  searching for changes
 +  [255]
 +  $ cd ../gitremoterepo
 +  $ gitstate
++    55b133e "add delta" refs: (master)
++    d338971 "add gamma" refs: (b1)
++    9497a4e "add beta" refs:
++    7eeab2e "add alpha" refs:
 +  $ cd ..
++
++Calling push -B should share the specified bookmark, but not others
++  $ cd purehglocalrepo
++  $ hg bookmark -ir 1 b3
++  $ hgstate
++    4 9a3af9d5e48d "append delta2" bookmarks: [master]
++    3 fc2664cac217 "add delta" bookmarks: []
++    2 d85ced7ae9d6 "add gamma" bookmarks: [b1]
++    1 7bcd915dc873 "add beta" bookmarks: [b3]
++    0 3442585be8a6 "add alpha" bookmarks: [b2]
++  $ hg push -B b2
++  pushing to $TESTTMP/hgremoterepo
++  searching for changes
++  no changes found
++  exporting bookmark b2
++  [1]
++  $ hgstate -R ../hgremoterepo
++    4 9a3af9d5e48d "append delta2" bookmarks: [master]
++    3 fc2664cac217 "add delta" bookmarks: []
++    2 d85ced7ae9d6 "add gamma" bookmarks: [b1]
++    1 7bcd915dc873 "add beta" bookmarks: []
++    0 3442585be8a6 "add alpha" bookmarks: [b2]
++  $ cd ..
++  $ cd hggitlocalrepo
++  $ hg bookmark -ir 1 b3
++  $ hgstate
++    4 9a3af9d5e48d "append delta2" bookmarks: [master]
++    3 fc2664cac217 "add delta" bookmarks: []
++    2 d85ced7ae9d6 "add gamma" bookmarks: [b1]
++    1 7bcd915dc873 "add beta" bookmarks: [b3]
++    0 3442585be8a6 "add alpha" bookmarks: [b2]
++  $ hg push -B b2
++  pushing to $TESTTMP/gitremoterepo
++  searching for changes
++  exporting bookmark b2
++  $ cd ../gitremoterepo
++  $ gitstate
++    55b133e "add delta" refs: (master)
++    d338971 "add gamma" refs: (b1)
++    9497a4e "add beta" refs:
++    7eeab2e "add alpha" refs: (b2)
++  $ cd ..

make_get_valid_git_username_email_static

-# HG changeset patch
-# User Gregory Szorc <gregory.szorc@gmail.com>
-# Date 1348284630 25200
-# Node ID ef583ac939de39b80aaff2d1d3d9f47bf1a1c9f3
-# Parent  2db03c124dde9c84de1006526f497d867094a231
-Make get_valid_git_username_email static
-
-Also alias where it is used to make code a little easier to read.
-
-diff --git a/hggit/git_handler.py b/hggit/git_handler.py
---- a/hggit/git_handler.py
-+++ b/hggit/git_handler.py
-@@ -403,17 +403,18 @@
-         commit.tree = tree_sha
- 
-         self.git.object_store.add_object(commit)
-         self.map_set(commit.id, ctx.hex())
- 
-         self.swap_out_encoding(oldenc)
-         return commit.id
- 
--    def get_valid_git_username_email(self, name):
-+    @staticmethod
-+    def get_valid_git_username_email(name):
-         r"""Sanitize usernames and emails to fit git's restrictions.
- 
-         The following is taken from the man page of git's fast-import
-         command:
- 
-             [...] Likewise LF means one (and only one) linefeed [...]
- 
-             committer
-@@ -435,17 +436,17 @@
-         angle brackets and spaces from the beginning, and right angle
-         brackets and spaces from the end, of this string, to convert
-         such things as " <john@doe.com> " to "john@doe.com" for
-         convenience.
- 
-         TESTS:
- 
-         >>> from mercurial.ui import ui
--        >>> g = GitHandler('', ui()).get_valid_git_username_email
-+        >>> g = GitHandler.get_valid_git_username_email
-         >>> g('John Doe')
-         'John Doe'
-         >>> g('john@doe.com')
-         'john@doe.com'
-         >>> g(' <john@doe.com> ')
-         'john@doe.com'
-         >>> g('    <random<\n<garbage\n>  > > ')
-         'random???garbage?'
-@@ -459,26 +460,28 @@
-         author = ctx.user()
- 
-         # see if a translation exists
-         author = self.author_map.get(author, author)
- 
-         # check for git author pattern compliance
-         a = RE_GIT_AUTHOR.match(author)
- 
-+        get_valid = GitHandler.get_valid_git_username_email
-+
-         if a:
--            name = self.get_valid_git_username_email(a.group(1))
--            email = self.get_valid_git_username_email(a.group(2))
-+            name = get_valid(a.group(1))
-+            email = get_valid(a.group(2))
-             if a.group(3) != None and len(a.group(3)) != 0:
-                 name += ' ext:(' + urllib.quote(a.group(3)) + ')'
--            author = self.get_valid_git_username_email(name) + ' <' + self.get_valid_git_username_email(email) + '>'
-+            author = get_valid(name) + ' <' + get_valid(email) + '>'
-         elif '@' in author:
--            author = self.get_valid_git_username_email(author) + ' <' + self.get_valid_git_username_email(author) + '>'
-+            author = get_valid(author) + ' <' + get_valid(author) + '>'
-         else:
--            author = self.get_valid_git_username_email(author) + ' <none@none>'
-+            author = get_valid(author) + ' <none@none>'
- 
-         if 'author' in ctx.extra():
-             author = "".join(apply_delta(author, ctx.extra()['author']))
- 
-         return author
- 
-     def get_git_parents(self, ctx):
-         def is_octopus_part(ctx):
-
--- 
-You received this message because you are subscribed to the Google Groups "hg-git" group.
-To post to this group, send email to hg-git@googlegroups.com.
-To unsubscribe from this group, send email to hg-git+unsubscribe@googlegroups.com.
-For more options, visit this group at http://groups.google.com/group/hg-git?hl=en.
-
 gitrepo-support-listkeys.diff
 test-changes-bookmarks-outgoing.diff
 fix-push-output.diff
+suppress-export-message.diff
 limit-push-scope.diff
-test-default-push.diff
 test-bookmark-workflow.diff
-test-export
-make_get_valid_git_username_email_static
-implement_treetracker_for_incremental_tree_calculation
-test-git-branch-loss.diff
 bookmark-delete.diff

suppress-export-message.diff

+# HG changeset patch
+# Parent cc0bf357e7eae6b7057aa2d7cb879c00c2a5422b
+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.
+
+diff --git a/hggit/git_handler.py b/hggit/git_handler.py
+--- a/hggit/git_handler.py
++++ b/hggit/git_handler.py
+@@ -339,7 +339,7 @@
+         export = [node for node in nodes if not hex(node) in self._map_hg]
+         total = len(export)
+         if total:
+-            self.ui.status(_("exporting hg objects to git\n"))
++            self.ui.note(_("exporting hg objects to git\n"))
+         for i, rev in enumerate(export):
+             util.progress(self.ui, 'exporting', i, total=total)
+             ctx = self.repo.changectx(rev)
+diff --git a/tests/test-conflict-1.t b/tests/test-conflict-1.t
+--- a/tests/test-conflict-1.t
++++ b/tests/test-conflict-1.t
+@@ -60,7 +60,6 @@
+   $ hg bookmark -r tip master
+   $ hg push -r master ../gitrepo
+   pushing to ../gitrepo
+-  exporting hg objects to git
+   searching for changes
+   $ cd ..
+ 
+diff --git a/tests/test-conflict-2.t b/tests/test-conflict-2.t
+--- a/tests/test-conflict-2.t
++++ b/tests/test-conflict-2.t
+@@ -60,7 +60,6 @@
+   $ hg bookmark -r tip master
+   $ hg push -r master ../gitrepo
+   pushing to ../gitrepo
+-  exporting hg objects to git
+   searching for changes
+   $ cd ..
+ 
+diff --git a/tests/test-convergedmerge.t b/tests/test-convergedmerge.t
+--- a/tests/test-convergedmerge.t
++++ b/tests/test-convergedmerge.t
+@@ -61,7 +61,6 @@
+   $ hg bookmark -r4 master
+   $ hg push -r master ../gitrepo
+   pushing to ../gitrepo
+-  exporting hg objects to git
+   searching for changes
+   $ cd ..
+ 
+diff --git a/tests/test-empty-working-tree.t b/tests/test-empty-working-tree.t
+--- a/tests/test-empty-working-tree.t
++++ b/tests/test-empty-working-tree.t
+@@ -39,7 +39,6 @@
+   clearing out the git cache data
+   $ hg push ../gitrepo2
+   pushing to ../gitrepo2
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ../gitrepo2
+diff --git a/tests/test-encoding.t b/tests/test-encoding.t
+--- a/tests/test-encoding.t
++++ b/tests/test-encoding.t
+@@ -121,7 +121,6 @@
+   clearing out the git cache data
+   $ hg push ../gitrepo2
+   pushing to ../gitrepo2
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ../gitrepo2
+diff --git a/tests/test-file-removal.t b/tests/test-file-removal.t
+--- a/tests/test-file-removal.t
++++ b/tests/test-file-removal.t
+@@ -108,7 +108,6 @@
+   clearing out the git cache data
+   $ hg push ../gitrepo2
+   pushing to ../gitrepo2
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ../gitrepo2
+diff --git a/tests/test-git-tags.t b/tests/test-git-tags.t
+--- a/tests/test-git-tags.t
++++ b/tests/test-git-tags.t
+@@ -71,7 +71,6 @@
+   $ hg commit -m 'fix for beta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ..
+diff --git a/tests/test-git-workflow.t b/tests/test-git-workflow.t
+old mode 100755
+new mode 100644
+--- a/tests/test-git-workflow.t
++++ b/tests/test-git-workflow.t
+@@ -66,7 +66,6 @@
+   $ echo "[git]" >> .hg/hgrc
+   $ echo "intree = True" >> .hg/hgrc
+   $ hg gexport
+-  exporting hg objects to git
+ 
+   $ echo % do some work
+   % do some work
+diff --git a/tests/test-hg-author.t b/tests/test-hg-author.t
+--- a/tests/test-hg-author.t
++++ b/tests/test-hg-author.t
+@@ -54,14 +54,12 @@
+   $ hgcommit -u "test" -m 'add beta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo gamma >> beta
+   $ hgcommit -u "test <test@example.com> (comment)" -m 'modify beta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo gamma > gamma
+@@ -69,7 +67,6 @@
+   $ hgcommit -u "<test@example.com>" -m 'add gamma'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo delta > delta
+@@ -77,7 +74,6 @@
+   $ hgcommit -u "name<test@example.com>" -m 'add delta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo epsilon > epsilon
+@@ -85,7 +81,6 @@
+   $ hgcommit -u "name <test@example.com" -m 'add epsilon'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo zeta > zeta
+@@ -93,7 +88,6 @@
+   $ hgcommit -u " test " -m 'add zeta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo eta > eta
+@@ -101,7 +95,6 @@
+   $ hgcommit -u "test < test@example.com >" -m 'add eta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ echo theta > theta
+@@ -109,7 +102,6 @@
+   $ hgcommit -u "test >test@example.com>" -m 'add theta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ hg log --graph | egrep -v ': *(not-master|master)'
+diff --git a/tests/test-hg-branch.t b/tests/test-hg-branch.t
+--- a/tests/test-hg-branch.t
++++ b/tests/test-hg-branch.t
+@@ -57,7 +57,6 @@
+   $ hgcommit -m 'rename alpha to beta'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ hg branch gamma | grep -v 'permanent and global'
+@@ -65,7 +64,6 @@
+   $ hgcommit -m 'started branch gamma'
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ hg log --graph | $filterhash | egrep -v ': *(not-master|master)'
+diff --git a/tests/test-hg-tags.t b/tests/test-hg-tags.t
+--- a/tests/test-hg-tags.t
++++ b/tests/test-hg-tags.t
+@@ -52,7 +52,6 @@
+   $ hgtag alpha
+   $ hg push
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ hg log --graph | egrep -v ': *(not-master|master)'
+diff --git a/tests/test-merge.t b/tests/test-merge.t
+--- a/tests/test-merge.t
++++ b/tests/test-merge.t
+@@ -69,7 +69,6 @@
+   clearing out the git cache data
+   $ hg push ../gitrepo2
+   pushing to ../gitrepo2
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ..
+diff --git a/tests/test-octopus.t b/tests/test-octopus.t
+--- a/tests/test-octopus.t
++++ b/tests/test-octopus.t
+@@ -96,7 +96,6 @@
+   clearing out the git cache data
+   $ hg push ../gitrepo2
+   pushing to ../gitrepo2
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ../gitrepo2
+diff --git a/tests/test-outgoing.t b/tests/test-outgoing.t
+old mode 100755
+new mode 100644
+--- a/tests/test-outgoing.t
++++ b/tests/test-outgoing.t
+@@ -60,7 +60,6 @@
+ 
+   $ hg outgoing | sed 's/bookmark:    /tag:         /' | grep -v 'searching for changes'
+   comparing with */gitrepo (glob)
+-  exporting hg objects to git
+   changeset:   1:0564f526fb0f
+   tag:         beta
+   user:        test
+diff --git a/tests/test-push.t b/tests/test-push.t
+--- a/tests/test-push.t
++++ b/tests/test-push.t
+@@ -59,7 +59,6 @@
+   $ hg book -r 1 beta
+   $ hg push -r beta
+   pushing to $TESTTMP/gitrepo
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ..
+diff --git a/tests/test-subrepos.t b/tests/test-subrepos.t
+--- a/tests/test-subrepos.t
++++ b/tests/test-subrepos.t
+@@ -115,7 +115,6 @@
+   $ hg commit -m 'Update subrepo2 from hg' | grep -v "committing subrepository" || true
+   $ hg push
+   pushing to $TESTTMP/gitrepo1
+-  exporting hg objects to git
+   searching for changes
+   $ cd ..
+   $ cd gitrepo1
+diff --git a/tests/test-tree-decomposition.t b/tests/test-tree-decomposition.t
+--- a/tests/test-tree-decomposition.t
++++ b/tests/test-tree-decomposition.t
+@@ -67,7 +67,6 @@
+   clearing out the git cache data
+   $ hg push ../gitrepo2
+   pushing to ../gitrepo2
+-  exporting hg objects to git
+   searching for changes
+ 
+   $ cd ../gitrepo2

test-default-push.diff

-# HG changeset patch
-# Parent 631c4c3b2fa099c8a0571740459250006d3aad93
-WIP tests: add coverage for default push with bookmark support
-
-diff -r 631c4c3b2fa0 tests/test-bookmark-workflow.t
---- a/tests/test-bookmark-workflow.t	Fri Sep 28 21:00:49 2012 -0400
-+++ b/tests/test-bookmark-workflow.t	Fri Sep 28 21:01:22 2012 -0400
-@@ -179,3 +179,32 @@
-   searching for changed bookmarks
-      b2                        3442585be8a6
-   $ cd ..
-+
-+Calling default push updates the shared bookmark, but doesn't share new
-+bookmarks
-+  $ cd purehglocalrepo
-+  $ hg push
-+  pushing to $TESTTMP/hgremoterepo
-+  searching for changes
-+  no changes found
-+  updating bookmark b1
-+  [1]
-+  $ hgstate -R ../hgremoterepo
-+    3 fc2664cac217 "add delta" bookmarks: [master]
-+    2 d85ced7ae9d6 "add gamma" bookmarks: [b1]
-+    1 7bcd915dc873 "add beta" bookmarks: []
-+    0 3442585be8a6 "add alpha" bookmarks: []
-+  $ cd ..
-+  $ cd hggitlocalrepo
-+  $ hg push
-+  pushing to $TESTTMP/gitremoterepo
-+  searching for changes
-+      default::refs/heads/b2 => GIT:7eeab2ea
-+      default::refs/heads/b1 => GIT:d338971a
-+  $ cd ../gitremoterepo
-+  $ gitstate
-+    55b133e "add delta" refs: (master)
-+    d338971 "add gamma" refs: (b1)
-+    9497a4e "add beta" refs:
-+    7eeab2e "add alpha" refs: (b2)
-+  $ cd ..

test-export

-# HG changeset patch
-# Parent 3b82cf6ac73ad8455a632516735070610eb5cd32
-diff --git a/test-export.sh b/test-export.sh
-new file mode 100755
---- /dev/null
-+++ b/test-export.sh
-@@ -0,0 +1,28 @@
-+#!/bin/sh
-+
-+rm -rf ~/temp/hg-git-export
-+mkdir -p ~/temp/hg-git-export
-+
-+hg clone -U http://hg.rafaelmartins.eng.br/blohg/ ~/temp/hg-git-export/hr1a
-+hg clone -U ~/temp/hg-git-export/hr1a ~/temp/hg-git-export/hr2a
-+hg clone -U ~/temp/hg-git-export/hr1a ~/temp/hg-git-export/hr3a
-+hg clone -U ~/temp/hg-git-export/hr1a ~/temp/hg-git-export/hr4a
-+git init --bare ~/temp/hg-git-export/gr1a
-+git init --bare ~/temp/hg-git-export/gr2a
-+git init --bare ~/temp/hg-git-export/gr3a
-+
-+hg clone -U -r f75567782aba http://selenic.com/repo/hg ~/temp/hg-git-export/hr1b
-+hg clone -U ~/temp/hg-git-export/hr1b ~/temp/hg-git-export/hr2b
-+hg clone -U ~/temp/hg-git-export/hr1b ~/temp/hg-git-export/hr3b
-+hg clone -U ~/temp/hg-git-export/hr1b ~/temp/hg-git-export/hr4b
-+git init --bare ~/temp/hg-git-export/gr1b
-+git init --bare ~/temp/hg-git-export/gr2b
-+git init --bare ~/temp/hg-git-export/gr3b
-+
-+time hg -R ~/temp/hg-git-export/hr2a push ~/temp/hg-git-export/gr1a
-+time hg -R ~/temp/hg-git-export/hr3a push ~/temp/hg-git-export/gr2a
-+time hg -R ~/temp/hg-git-export/hr4a push ~/temp/hg-git-export/gr3a
-+
-+time hg -R ~/temp/hg-git-export/hr2b push ~/temp/hg-git-export/gr1b
-+time hg -R ~/temp/hg-git-export/hr3b push ~/temp/hg-git-export/gr2b
-+time hg -R ~/temp/hg-git-export/hr4b push ~/temp/hg-git-export/gr3b

test-git-branch-loss.diff

-# HG changeset patch
-# Parent 878ae1d1bd73f5e079f6990b4a93e9a9f5405fb8
-diff -r 878ae1d1bd73 -r a68fb6d66262 tests/test-git-branch-loss.t
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/tests/test-git-branch-loss.t	Mon Sep 24 23:09:28 2012 -0400
-@@ -0,0 +1,434 @@
-+# Fails for some reason, need to investigate
-+#   $ "$TESTDIR/hghave" git || exit 80
-+
-+bail if the user does not have dulwich
-+  $ python -c 'import dulwich, dulwich.repo' || exit 80
-+
-+  $ echo "[extensions]" >> $HGRCPATH
-+  $ echo "hggit=$(echo $(dirname $TESTDIR))/hggit" >> $HGRCPATH
-+  $ echo 'hgext.graphlog =' >> $HGRCPATH
-+
-+  $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
-+  $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
-+  $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
-+  $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
-+  $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
-+  $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
-+
-+  $ count=10
-+  $ commit()
-+  > {
-+  >     GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
-+  >     GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
-+  >     git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" | sed 's/, 0 deletions(-)//'
-+  >     count=`expr $count + 1`
-+  > }
-+
-+  $ mkdir gitrepo
-+  $ cd gitrepo
-+  $ git init
-+  Initialized empty Git repository in $TESTTMP/gitrepo/.git/
-+  $ echo alpha > alpha
-+  $ git add alpha
-+  $ commit -m 'add alpha'
-+
-+  $ git checkout -b beta 2>&1 | sed s/\'/\"/g
-+  Switched to a new branch "beta"
-+  $ echo beta > beta
-+  $ git add beta
-+  $ commit -m 'add beta'
-+
-+  $ git checkout master 2>&1 | sed s/\'/\"/g
-+  Switched to branch "master"
-+  $ echo gamma > gamma
-+  $ git add gamma
-+  $ commit -m 'add gamma'
-+
-+  $ git checkout -b develop 2>&1 | sed s/\'/\"/g
-+  Switched to a new branch "develop"
-+  $ echo dev > dev
-+  $ git add dev
-+  $ commit -m 'add dev'
-+
-+  $ git checkout master 2>&1 | sed s/\'/\"/g
-+  Switched to branch "master"
-+  $ git merge beta | sed "s/the '//;s/' strategy//" | sed 's/^Merge.*recursive.*$/Merge successful/' | sed 's/files/file/;s/insertions/insertion/;s/, 0 deletions.*//' | sed 's/|  */| /'
-+  Merge successful
-+   beta | 1 +
-+   1 file changed, 1 insertion(+)
-+   create mode 100644 beta
-+  $ git log --pretty=medium --all
-+  commit 45abb370c52ac9e0347ebb208ee09f6dd482c227
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:13 2007 +0000
-+  
-+      add dev
-+  
-+  commit 4201a42f8acb6e76ad7e3f7d163b6720f41ce588
-+  Merge: e5023f9 9497a4e
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:13 2007 +0000
-+  
-+      Merge branch 'beta'
-+  
-+  commit e5023f9e5cb24fdcec7b6c127cec45d8888e35a9
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:12 2007 +0000
-+  
-+      add gamma
-+  
-+  commit 9497a4ee62e16ee641860d7677cdb2589ea15554
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:11 2007 +0000
-+  
-+      add beta
-+  
-+  commit 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:10 2007 +0000
-+  
-+      add alpha
-+  $ git branch -a
-+    beta
-+    develop
-+  * master
-+  $ cd ..
-+
-+  $ hg clone gitrepo hgrepo | grep -v '^updating'
-+  importing git objects into hg
-+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-+  $ cd hgrepo
-+  $ hg update develop
-+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-+  $ echo dev2 >> dev
-+  $ hg commit -m "change dev"
-+  $ hg log --graph
-+  @  changeset:   5:89ef27525c81
-+  |  bookmark:    develop
-+  |  tag:         tip
-+  |  parent:      3:cef87f787c94
-+  |  user:        test
-+  |  date:        Thu Jan 01 00:00:00 1970 +0000
-+  |  summary:     change dev
-+  |
-+  | o    changeset:   4:d00ec1364b84
-+  | |\   bookmark:    master
-+  | | |  tag:         default/master
-+  | | |  parent:      2:37c124f2d0a0
-+  | | |  parent:      1:7bcd915dc873
-+  | | |  user:        test <test@example.org>
-+  | | |  date:        Mon Jan 01 00:00:13 2007 +0000
-+  | | |  summary:     Merge branch 'beta'
-+  | | |
-+  o---+  changeset:   3:cef87f787c94
-+    | |  tag:         default/develop
-+   / /   user:        test <test@example.org>
-+  | |    date:        Mon Jan 01 00:00:13 2007 +0000
-+  | |    summary:     add dev
-+  | |
-+  | o  changeset:   2:37c124f2d0a0
-+  | |  parent:      0:3442585be8a6
-+  | |  user:        test <test@example.org>
-+  | |  date:        Mon Jan 01 00:00:12 2007 +0000
-+  | |  summary:     add gamma
-+  | |
-+  o |  changeset:   1:7bcd915dc873
-+  |/   bookmark:    beta
-+  |    tag:         default/beta
-+  |    user:        test <test@example.org>
-+  |    date:        Mon Jan 01 00:00:11 2007 +0000
-+  |    summary:     add beta
-+  |
-+  o  changeset:   0:3442585be8a6
-+     user:        test <test@example.org>
-+     date:        Mon Jan 01 00:00:10 2007 +0000
-+     summary:     add alpha
-+  
-+  $ hg bookmarks
-+     beta                      1:7bcd915dc873
-+   * develop                   5:89ef27525c81
-+     master                    4:d00ec1364b84
-+  $ hg tags -v
-+  tip                                5:89ef27525c81
-+  default/master                     4:d00ec1364b84
-+  default/develop                    3:cef87f787c94
-+  default/beta                       1:7bcd915dc873
-+  $ hg heads
-+  changeset:   5:89ef27525c81
-+  bookmark:    develop
-+  tag:         tip
-+  parent:      3:cef87f787c94
-+  user:        test
-+  date:        Thu Jan 01 00:00:00 1970 +0000
-+  summary:     change dev
-+  
-+  changeset:   4:d00ec1364b84
-+  bookmark:    master
-+  tag:         default/master
-+  parent:      2:37c124f2d0a0
-+  parent:      1:7bcd915dc873
-+  user:        test <test@example.org>
-+  date:        Mon Jan 01 00:00:13 2007 +0000
-+  summary:     Merge branch 'beta'
-+  
-+  $ hg gclear
-+  clearing out the git cache data
-+  $ hg log --graph
-+  @  changeset:   5:89ef27525c81
-+  |  bookmark:    develop
-+  |  tag:         tip
-+  |  parent:      3:cef87f787c94
-+  |  user:        test
-+  |  date:        Thu Jan 01 00:00:00 1970 +0000
-+  |  summary:     change dev
-+  |
-+  | o    changeset:   4:d00ec1364b84
-+  | |\   bookmark:    master
-+  | | |  tag:         default/master
-+  | | |  parent:      2:37c124f2d0a0
-+  | | |  parent:      1:7bcd915dc873
-+  | | |  user:        test <test@example.org>
-+  | | |  date:        Mon Jan 01 00:00:13 2007 +0000
-+  | | |  summary:     Merge branch 'beta'
-+  | | |
-+  o---+  changeset:   3:cef87f787c94
-+    | |  tag:         default/develop
-+   / /   user:        test <test@example.org>
-+  | |    date:        Mon Jan 01 00:00:13 2007 +0000
-+  | |    summary:     add dev
-+  | |
-+  | o  changeset:   2:37c124f2d0a0
-+  | |  parent:      0:3442585be8a6
-+  | |  user:        test <test@example.org>
-+  | |  date:        Mon Jan 01 00:00:12 2007 +0000
-+  | |  summary:     add gamma
-+  | |
-+  o |  changeset:   1:7bcd915dc873
-+  |/   bookmark:    beta
-+  |    tag:         default/beta
-+  |    user:        test <test@example.org>
-+  |    date:        Mon Jan 01 00:00:11 2007 +0000
-+  |    summary:     add beta
-+  |
-+  o  changeset:   0:3442585be8a6
-+     user:        test <test@example.org>
-+     date:        Mon Jan 01 00:00:10 2007 +0000
-+     summary:     add alpha
-+  
-+  $ hg bookmarks
-+     beta                      1:7bcd915dc873
-+   * develop                   5:89ef27525c81
-+     master                    4:d00ec1364b84
-+  $ hg tags -v
-+  tip                                5:89ef27525c81
-+  default/master                     4:d00ec1364b84
-+  default/develop                    3:cef87f787c94
-+  default/beta                       1:7bcd915dc873
-+  $ hg heads
-+  changeset:   5:89ef27525c81
-+  bookmark:    develop
-+  tag:         tip
-+  parent:      3:cef87f787c94
-+  user:        test
-+  date:        Thu Jan 01 00:00:00 1970 +0000
-+  summary:     change dev
-+  
-+  changeset:   4:d00ec1364b84
-+  bookmark:    master
-+  tag:         default/master
-+  parent:      2:37c124f2d0a0
-+  parent:      1:7bcd915dc873
-+  user:        test <test@example.org>
-+  date:        Mon Jan 01 00:00:13 2007 +0000
-+  summary:     Merge branch 'beta'
-+  
-+  $ hg pull ../gitrepo
-+  pulling from ../gitrepo
-+  exporting hg objects to git
-+  (run 'hg heads .' to see heads, 'hg merge' to merge)
-+  $ hg log --graph
-+  @  changeset:   5:89ef27525c81
-+  |  bookmark:    develop
-+  |  tag:         tip
-+  |  parent:      3:cef87f787c94
-+  |  user:        test
-+  |  date:        Thu Jan 01 00:00:00 1970 +0000
-+  |  summary:     change dev
-+  |
-+  | o    changeset:   4:d00ec1364b84
-+  | |\   bookmark:    master
-+  | | |  tag:         default/master
-+  | | |  parent:      2:37c124f2d0a0
-+  | | |  parent:      1:7bcd915dc873
-+  | | |  user:        test <test@example.org>
-+  | | |  date:        Mon Jan 01 00:00:13 2007 +0000
-+  | | |  summary:     Merge branch 'beta'
-+  | | |
-+  o---+  changeset:   3:cef87f787c94
-+    | |  tag:         default/develop
-+   / /   user:        test <test@example.org>
-+  | |    date:        Mon Jan 01 00:00:13 2007 +0000
-+  | |    summary:     add dev
-+  | |
-+  | o  changeset:   2:37c124f2d0a0
-+  | |  parent:      0:3442585be8a6
-+  | |  user:        test <test@example.org>
-+  | |  date:        Mon Jan 01 00:00:12 2007 +0000
-+  | |  summary:     add gamma
-+  | |
-+  o |  changeset:   1:7bcd915dc873
-+  |/   bookmark:    beta
-+  |    tag:         default/beta
-+  |    user:        test <test@example.org>
-+  |    date:        Mon Jan 01 00:00:11 2007 +0000
-+  |    summary:     add beta
-+  |
-+  o  changeset:   0:3442585be8a6
-+     user:        test <test@example.org>
-+     date:        Mon Jan 01 00:00:10 2007 +0000
-+     summary:     add alpha
-+  
-+  $ hg bookmarks
-+     beta                      1:7bcd915dc873
-+   * develop                   5:89ef27525c81
-+     master                    4:d00ec1364b84
-+  $ hg tags -v
-+  tip                                5:89ef27525c81
-+  default/master                     4:d00ec1364b84
-+  default/develop                    3:cef87f787c94
-+  default/beta                       1:7bcd915dc873
-+  $ hg heads
-+  changeset:   5:89ef27525c81
-+  bookmark:    develop
-+  tag:         tip
-+  parent:      3:cef87f787c94
-+  user:        test
-+  date:        Thu Jan 01 00:00:00 1970 +0000
-+  summary:     change dev
-+  
-+  changeset:   4:d00ec1364b84
-+  bookmark:    master
-+  tag:         default/master
-+  parent:      2:37c124f2d0a0
-+  parent:      1:7bcd915dc873
-+  user:        test <test@example.org>
-+  date:        Mon Jan 01 00:00:13 2007 +0000
-+  summary:     Merge branch 'beta'
-+  
-+  $ hg push ../gitrepo
-+  pushing to ../gitrepo
-+  creating and sending data
-+  $ hg log --graph
-+  @  changeset:   5:89ef27525c81
-+  |  bookmark:    develop
-+  |  tag:         tip
-+  |  parent:      3:cef87f787c94
-+  |  user:        test
-+  |  date:        Thu Jan 01 00:00:00 1970 +0000
-+  |  summary:     change dev
-+  |
-+  | o    changeset:   4:d00ec1364b84
-+  | |\   bookmark:    master
-+  | | |  tag:         default/master
-+  | | |  parent:      2:37c124f2d0a0
-+  | | |  parent:      1:7bcd915dc873
-+  | | |  user:        test <test@example.org>
-+  | | |  date:        Mon Jan 01 00:00:13 2007 +0000
-+  | | |  summary:     Merge branch 'beta'
-+  | | |
-+  o---+  changeset:   3:cef87f787c94
-+    | |  tag:         default/develop
-+   / /   user:        test <test@example.org>
-+  | |    date:        Mon Jan 01 00:00:13 2007 +0000
-+  | |    summary:     add dev
-+  | |
-+  | o  changeset:   2:37c124f2d0a0
-+  | |  parent:      0:3442585be8a6
-+  | |  user:        test <test@example.org>
-+  | |  date:        Mon Jan 01 00:00:12 2007 +0000
-+  | |  summary:     add gamma
-+  | |
-+  o |  changeset:   1:7bcd915dc873
-+  |/   bookmark:    beta
-+  |    tag:         default/beta
-+  |    user:        test <test@example.org>
-+  |    date:        Mon Jan 01 00:00:11 2007 +0000
-+  |    summary:     add beta
-+  |
-+  o  changeset:   0:3442585be8a6
-+     user:        test <test@example.org>
-+     date:        Mon Jan 01 00:00:10 2007 +0000
-+     summary:     add alpha
-+  
-+  $ hg bookmarks
-+     beta                      1:7bcd915dc873
-+   * develop                   5:89ef27525c81
-+     master                    4:d00ec1364b84
-+  $ hg tags -v
-+  tip                                5:89ef27525c81
-+  default/master                     4:d00ec1364b84
-+  default/develop                    3:cef87f787c94
-+  default/beta                       1:7bcd915dc873
-+  $ hg heads
-+  changeset:   5:89ef27525c81
-+  bookmark:    develop
-+  tag:         tip
-+  parent:      3:cef87f787c94
-+  user:        test
-+  date:        Thu Jan 01 00:00:00 1970 +0000
-+  summary:     change dev
-+  
-+  changeset:   4:d00ec1364b84
-+  bookmark:    master
-+  tag:         default/master
-+  parent:      2:37c124f2d0a0
-+  parent:      1:7bcd915dc873
-+  user:        test <test@example.org>
-+  date:        Mon Jan 01 00:00:13 2007 +0000
-+  summary:     Merge branch 'beta'
-+  
-+  $ cd ..
-+
-+  $ cd gitrepo
-+  $ git log --pretty=medium --all
-+  commit 4201a42f8acb6e76ad7e3f7d163b6720f41ce588
-+  Merge: e5023f9 9497a4e
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:13 2007 +0000
-+  
-+      Merge branch 'beta'
-+  
-+  commit e5023f9e5cb24fdcec7b6c127cec45d8888e35a9
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:12 2007 +0000
-+  
-+      add gamma
-+  
-+  commit 9497a4ee62e16ee641860d7677cdb2589ea15554
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:11 2007 +0000
-+  
-+      add beta
-+  
-+  commit 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:10 2007 +0000
-+  
-+      add alpha
-+  
-+  commit c15cff1d053993efc9f84b44e7852ea12187bda1
-+  Author: test <none@none>
-+  Date:   Thu Jan 1 00:00:00 1970 +0000
-+  
-+      change dev
-+  
-+  commit 45abb370c52ac9e0347ebb208ee09f6dd482c227
-+  Author: test <test@example.org>
-+  Date:   Mon Jan 1 00:00:13 2007 +0000
-+  
-+      add dev
-+  $ git branch -a
-+    beta
-+    develop
-+  * master
-+  $ cd ..