Skip to content
Snippets Groups Projects
  1. Jan 06, 2013
    • David M. Carr's avatar
      push: add more output about what was added (issue #64) · 163c452531cf
      David M. Carr authored
      l33t pointed out that currently, Hg-Git doesn't provide any confirmation that a
      push was successful other than the exit code.  Normal Mercurial provides a
      couple other messages followed by "added X changesets with Y changes to
      Z files".  After this change, Hg-Git will provide much more similar output.
      It's not identical, as the underlying model is substantially different, but the
      concept is the same.  The main message is "added X commits with Y trees and
      Z blobs".
      
      This change doesn't affect the output of what references/branches were touched.
      That will be addressed in a subsequent commit.
      
      Dulwich doesn't provide an easy hook to get the information needed for this
      output.  Instead of passing generate_pack_contents as the pack generator
      function to send_pack, I pass a custom function that determines the "missing"
      objects, stores the counts, and then calls generate_pack_contents (which then
      will determine the "missing" objects again.
      
      The new expected output:
      searching for changes # unless quiet true
      <N> commits found     # if verbose true
      list of commits:      # if debugflag true and at least one commit found
      <each hash>           # if debugflag true and at least one commit found
      adding objects        # if at least one commit found unless quiet true
      added <N> commits with <N> trees and <N> blobs # if at least one object unless
                                                     # quiet true
      
      https://bitbucket.org/durin42/hg-git/issue/64/push-confirmation
      163c452531cf
  2. Nov 24, 2012
  3. Nov 22, 2012
  4. Nov 11, 2012
  5. Nov 04, 2012
    • David M. Carr's avatar
      tests: use fn_git_commit in test-encoding.t · 24d4741674a6
      David M. Carr authored
      In c4849b2dab87, the "commit" function was extracted into a testutil for re-use.
      However, test-encoding.t was skipped over in that changeset, as I was seeing
      unexplained test failures.  Since those test failures have now been explained
      (and fixed), this changeset performs the same extraction on test-encoding.t as
      was done on all the other tests.
      
      The version of fn_git_commit that was used in testutil redirected all output
      (including errors) to /dev/null, which didn't match the expectations of this
      test.  The test utility functions for commit/tag now no longer throw away error
      output, instead leaving it to individual tests to decide if error output should
      be ignored.
      24d4741674a6
    • David M. Carr's avatar
      tests: make test-encoding.t compatible with git 1.8.0 · fbbdbc8a8785
      David M. Carr authored
      It looks like Git 1.8.0 started silently converting latin1 commit messages to
      utf-8.  That changed the result of this test.  This changeset alters the test
      to make it accept both the pre-1.8.0 and post-1.8.0 behaviors.
      
      https://raw.github.com/git/git/master/Documentation/RelNotes/1.8.0.txt
      fbbdbc8a8785
  6. Nov 03, 2012
    • David M. Carr's avatar
      tests: remove filterhash from test-incoming.t · 8e8d06e75e74
      David M. Carr authored
      This test had some form of legacy hash filtering, marked with a TODO to remove
      it when we're only supporting Mercurial 1.5 or later.  Well, that time has
      come, so I removed it.
      8e8d06e75e74
    • David M. Carr's avatar
      tests: remove mercurial version check from test-incoming.t · d92439a50837
      David M. Carr authored
      This test was only running on Mercurial 1.7 or later.  Since now we only
      support versions that are 1.7 or later, there isn't a need to perform this
      check any more.
      d92439a50837
    • David M. Carr's avatar
      tests: remove mercurial version check from test-pull-after-strip.t · 819e46cffc84
      David M. Carr authored
      This test was being skipped in Mercurial < 1.5.  We don't support Mercurial
      that old any more, so there isn't a need to worry about it in the tests.
      819e46cffc84
    • David M. Carr's avatar
      tests: convert echos to comments · 52461f71a782
      David M. Carr authored
      Now that we're in the unified test format, there isn't a need to use echo
      to provide context to command output.  This technique actually ends up resulting
      in redundant output.  To preserve the original context, but eliminate the
      redundancy, such echo statements have been converted into comment lines.
      52461f71a782
    • David M. Carr's avatar
      tests: avoid changing the current directory · 6cc99298b69e
      David M. Carr authored
      Mercurial allows specifying which repository to use via the -R/--repository
      option.  Git allows a similar function using the --git-dir option.  By using
      these options, in many cases we can avoid checking the current directory.
      This makes tests easier to understand, as you don't need to remember which
      directory you're in to understand what's going on.  It also makes tests easier
      to write, as you don't need to remember to cd out of a directory when you're
      done doing things there.
      
      Thanks to Felipe Contreras for the patch which this was based on.
      6cc99298b69e
    • David M. Carr's avatar
      tests: extract git command-line client and dulwich requirements into testutil · 675f19af79ca
      David M. Carr authored
      One or both of these requirements were in almost every test in exactly the same
      way.  Now, these checks are performed in every test that uses the testutil.
      This makes it easier for test authors to add these checks into new tests (just
      add a reference to the testutil, which you'd probably want anyway).
      
      We considered having each test declare their requirements (currently, either
      "git" or "dulwich"), but in this case, preferred the simplicity of having the
      check always performed (even if a particular test doesn't need one or the
      other).  You can't perform any meaningful testing of Hg-Git without both of
      these dependencies properly configured.  The main value to checking for them
      in the tests (rather than just letting the tests fail) is that it gives a
      meaningful error message to help people figure out how to fix their environment.
      In the case that either git or dulwich is missing, the information will be
      just as clearly conveyed regardless of whether its all the tests that are
      skipped, or just most of them.
      
      I didn't add dulwich to hghave (even though this is clearly the sort of thing
      that hghave is intended for) because hghave is currently pulled from Mercurial
      completely unchanged, and it's probably best to keep it that way.
      
      Tested by running the tests in three configurations:
       * No dulwich installed (ran 0, skipped 28, failed 0, output:
              Skipped *: missing feature: dulwich)
       * Bad git on path (ran 1, skipped 27, failed 0, output:
              Skipped *: missing feature: git command line client)
       * Working git and correct version of dulwich installed
              (ran 28, skipped 0, failed 0)
      
      Thanks to Felipe Contreras for the idea to extract this logic into a library.
      675f19af79ca
  7. Oct 31, 2012
    • David M. Carr's avatar
      tests: let git init create directories when applicable · 935c4fb1bbfc
      David M. Carr authored
      It's functionally equivalent to create a directory, cd into it, git init, and
      cd out of the directory, or simply git init with the directory specified.
      
      In several cases, we were doing the former without performing any other
      operations in the git repo, which just made the test unneccesarily complex.
      Even in the case where we still want to cd into the directory, calling git
      init with the directory name eliminates the need for a separate mkdir command.
      
      This changeset converts the former approach to the latter with the goal of
      increasing the readability of the tests.
      
      Thanks to Felipe Contreras for the patch which this was based on.
      935c4fb1bbfc
    • David M. Carr's avatar
      tests: add check for dulwich in test-url-parsing.py · daf3e44a4aa9
      David M. Carr authored
      Previously, if dulwich wasn't available, this test would fail with a traceback
      (example included below).  This changeset makes it so that the test will be
      skipped with an informative message if dulwich isn't available.
      
      Traceback (most recent call last):
        File "/Users/carrd/hg-repos/hg-git-queue/tests/test-url-parsing.py", line 6, in <module>
          from hggit.git_handler import GitHandler
        File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/__init__.py", line 42, in <module>
          import gitrepo, hgrepo
        File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/gitrepo.py", line 13, in <module>
          from git_handler import GitHandler
        File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/git_handler.py", line 4, in <module>
          from dulwich.errors import HangupException, GitProtocolError, UpdateRefsError
      ImportError: No module named dulwich.errors
      daf3e44a4aa9
    • David M. Carr's avatar
      tests: extract commonly used commit/tag functions into testutil library · c4849b2dab87
      David M. Carr authored
      Thanks to Felipe Contreras for the patch which this was based on.
      
      The functions were renamed to make it clearer that these are shell functions
      rather than normal git/hg commands, and to make it clearer which tool is being
      invoked.
      
      Old name | New name
      ------------------------
      commit   | fn_git_commit
      tag      | fn_git_tag
      hgcommit | fn_hg_commit
      hgtag    | fn_hg_tag
      
      Extraction from test-encoding.t was left for a subsequent patch, as I was seeing
      unexpected output changes when I attempted the extraction.
      
      The gitcommit and hgcommit functions in test-bookmark-workflow.t were left
      as-is for now, as they have a different behavior than the standard version
      (separate counters for each).
      c4849b2dab87
    • David M. Carr's avatar
      tests: extract extension configuration into a testutil library · a7da97e69d56
      David M. Carr authored
      Thanks to Felipe Contreras for the patch which this was based on.
      
      Even though the MQ extension was only used in a single test
      (test-pull-after-strip.t), I included it in the testutil.  It shouldn't hurt
      anything to have it enabled and not used, and saves us from having to deal
      with enabling extensions in individual tests at all.
      
      Similarly, this changeset results in the graphlog extension being enabled
      for all tests, even though there were some that didn't use it before.  This is
      even less significant in Mercurial 2.3+, since in those versions, graphlog is
      part of core, and is available even when the extension is disabled.
      a7da97e69d56
  8. Nov 01, 2012
  9. Oct 30, 2012
    • David M. Carr's avatar
      tests: remove git-daemon check from test-subrepos.t · a9165a7d8082
      David M. Carr authored
      This check is a remnant from back when we were using git-daemon in the tests.
      a9165a7d8082
    • durin42's avatar
      Merge obsolete marker fix. · a24c2f90a3dd
      durin42 authored
      a24c2f90a3dd
    • durin42's avatar
      test-pull.t: normalize git-merge output · 92aa31a3a1dd
      durin42 authored
      92aa31a3a1dd
    • David M. Carr's avatar
      overlaychangectx: fix compatibility with mercurial 2.4-rc (no attribute _repo) · 41f6e3df67b1
      David M. Carr authored
      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'
      41f6e3df67b1
  10. Oct 29, 2012
    • David M. Carr's avatar
      tests: fix check for dulwich in test-subrepos.t · b933b2b06b87
      David M. Carr authored
      In converting this test to the unified format, it looks like we missed this
      line.  It was accidentally being treated as a comment rather than executable.
      b933b2b06b87
    • David M. Carr's avatar
      tests: uncomment calls to hghave git · 81832807d193
      David M. Carr authored
      Now that hghave git works properly, uncomment the calls, and add ones that were
      missing.
      81832807d193
    • David M. Carr's avatar
      tests: pull in hghave · 8c6dc6a6f5d8
      David M. Carr authored
      Previously, the hghave checks that were commented out in the tests were broken
      if uncommented.  One cause was that it was expecting hghave in the testdir,
      while our testdir didn't contain hghave.  Now it does.
      
      The hghave was pulled unmodified from Mercurial 2.3, to match the version of
      run-tests.py in use.
      8c6dc6a6f5d8
    • David M. Carr's avatar
      listkeys: simplify ref stripping expression · b3881fda3ce9
      David M. Carr authored
      Eliminate a find that would always return 0, based on an example in git_handler
      update_hg_bookmarks.
      b3881fda3ce9
  11. Oct 27, 2012
  12. Oct 26, 2012
    • durin42's avatar
      Merge · 9f919924bf81
      durin42 authored
      9f919924bf81
    • David M. Carr's avatar
      push: suppress "exporting hg objects to git" message · 9c71a6f00863
      David M. Carr authored
      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.
      9c71a6f00863
    • David M. Carr's avatar
      push: suppress ref output by default · d4ccec82b816
      David M. Carr authored
      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.
      d4ccec82b816
    • David M. Carr's avatar
      ab8061d9942b
    • David M. Carr's avatar
      gitrepo: initial support for listkeys · 4f4ab2d89375
      David M. Carr authored
      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.
      4f4ab2d89375
  13. Oct 25, 2012
    • David M. Carr's avatar
      peer: pass localrepo to new gitrepo instances · affd119533ae
      David M. Carr authored
      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.
      affd119533ae
    • David M. Carr's avatar
      push: fix traceback when pushing empty hg repo to empty git repo (issue #58) · 06a29fdd52a7
      David M. Carr authored
      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.
      06a29fdd52a7
  14. Oct 18, 2012
  15. Oct 17, 2012
    • durin42's avatar
      Merge · f3f344aac42b
      durin42 authored
      f3f344aac42b
    • durin42's avatar
      git_handler: lazy-load mapping · bff92a208c3f
      durin42 authored
      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.
      bff92a208c3f
Loading