Skip to content
Snippets Groups Projects
  1. Nov 26, 2017
  2. Nov 23, 2017
  3. Nov 26, 2017
    • Matt Harbison's avatar
      convert: allow the sink object to be wrapped when the extension isn't loaded · 9700cb9df140
      Matt Harbison authored
      The next patch will wrap the conversion code, in order to write out a
      requirement for 'lfs' when appropriate.  Wrapping convcmd.convertsink() in an
      afterloaded callback works fine when the convert extension is enabled by the
      user.  The problem here is that lfconvert uses the convert extension, whether or
      not it was formally enabled by the user.
      
      My first attempt was to have lfs install an afterloaded callback that would wrap
      the convert sink if convert was loaded, or wrap lfconvert if it wasn't.  Then
      the lfconvert override could install an afterloaded callback to try wrapping the
      convert sink again, before calling the original lfconvert.  But that breaks down
      if largefiles can't load the convert extension on the fly. [1]  Further, some
      tests were failing with an error indicating that the size of the afterloaded
      list changed while iterating it.
      
      Yuya mentioned that maybe some bits of convert could be moved into core, but I'm
      not sure where to draw that line.  The convertsink() method depends on the list
      of sinks, which in turn depends on the sink classes.
      
      [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-November/108038.html
      9700cb9df140
  4. Nov 23, 2017
    • Matt Harbison's avatar
      convert: save an indicator of the repo type for sources and sinks · 671aba341d90
      Matt Harbison authored
      This seems like basic info to have, and will be used shortly when deciding
      whether or not to wrap the class for lfs conversions.
      
      The other option is to just add a function to each class.  But this seems better
      in that the strings aren't duplicated, and the constructor for most of these
      will run even if the VCS isn't installed, so it's easier to catch errors.
      671aba341d90
  5. Nov 16, 2017
    • Matt Harbison's avatar
      lfs: add a repo requirement for this extension once an lfs file is committed · e0a1b9ee93cd
      Matt Harbison authored
      Largefiles does the same thing (also delayed until the first largefile commit),
      to prevent access to the repo without the extension.  In the case of this
      extension, not having the extension loaded while accessing an lfs file results
      in cryptic errors about "missing processor for flag '0x2000'".  If enabled
      locally but not remotely, the cryptic error message is about no common
      changegroup version.  (It wants '03', which is currently experimental.)
      
      The largefiles extension looks for any tracked file that starts with '.hglf/'.
      Unfortunately, that doesn't work here.  I didn't see any way to get the files
      that were just committed, without doing a full status.  But since there's no
      secondary check on adding an lfs file once the extension is loaded and a
      threshold set, the best practice is to only enable this locally on a repo that
      needs it.  That should minimize the unnecessary overhead for repos without an
      lfs file.
      e0a1b9ee93cd
  6. Nov 30, 2017
  7. Nov 22, 2017
    • Anton Shestakov's avatar
      hgweb: add .jshintrc with some basic rules · bdd2e18b54c5
      Anton Shestakov authored
      This file is picked up automatically by jshint, so no extra changes required in
      test-check-jshint.t.
      bdd2e18b54c5
    • Anton Shestakov's avatar
      hgweb: look up "URLSearchParams" in "window" to work around jshint issues · 1207a50a6dc3
      Anton Shestakov authored
      Unfortunately, current version of jshint (2.9.5) doesn't know such a global
      variable and complains that it's undefined. Since this line tries to look up
      URLSearchParams in a global scope (i.e. window), let's simply preface it with
      "window." to work around jshint.
      1207a50a6dc3
    • Anton Shestakov's avatar
      hgweb: define locally used variables as actually local in mercurial.js · 69a865dc2ada
      Anton Shestakov authored
      Variables that are used or assigned without any declaration using var (or let,
      or const) are considered global. In many cases this is inadvertent and actually
      causes a variable leaking to a broader scope, such as a temporary variable used
      inside a loop suddenly being accessible in global scope. (This corresponds to
      "undef" option of jshint).
      
      So this patch limits the scope of variables that don't need to be global. There
      are a lot of helper variables in Graph.render() used in a loop, I've declared
      them all on one line to reduce patch size. "radius" is special because it
      wasn't passed to graph.vertex, but was used there (it worked because this
      variable leaked to global scope). "window.graph" is created by an inline script
      in graph.tmpl so that it can be used in ajaxScrollInit() function, this patch
      makes this fact explicit by assigning window.graph to a local variable.
      69a865dc2ada
    • Anton Shestakov's avatar
      hgweb: rename an instance of XMLHttpRequest to xhr in mercurial.js · 018aac6d7cb0
      Anton Shestakov authored
      "xhr" is a really widespread name for this kind of things, no idea where did
      "xfr" come from (the original 2228bd109706 doesn't explain that). Let's just
      change one letter so the name makes more sense.
      018aac6d7cb0
    • Anton Shestakov's avatar
      hgweb: properly iterate over arrays and objects in mercurial.js · 241da2de0e9f
      Anton Shestakov authored
      In JavaScript, using for-in loops to access every property of an object can
      have unexpected results when inheritance is involved. For example, if some
      piece of code adds a property (it may be a method too) to Object.prototype,
      then all for-in loops that iterate over keys of any object (also anything that
      inherits Object) will get that property on one of the iterations. To filter out
      such unexpected properties for-in loops have to use Object.hasOwnProperty()
      method. (This corresponds to "forin" option of jshint).
      
      In the two first cases "data" and "edges" are arrays, to it's simpler to just
      switch to using a regular for-with-a-counter loop.
      241da2de0e9f
    • Anton Shestakov's avatar
      hgweb: use strict equals in mercurial.js · ccf86aa5797c
      Anton Shestakov authored
      This patch changes "==" (equals operator) to "===" (strict equals operator).
      The difference between them is that the latter doesn't do any type coercions.
      It's handy to compare string '1' to number 1 sometimes, but most of the time
      using "==" is inadvertent and can be replaced by an explicit type conversion.
      (This corresponds to "eqeqeq" option of jshint).
      
      Some of the changes in this patch are straightforward, e.g. when comparing
      results of typeof (they could only be strings). The same goes for 'none' and
      similar strings that can't be sensibly coerced to some other type. Two changes
      that compare values to "1" and "0" can be clarified: getAttribute() returns
      either a string or null, but comparing null to a string is always false, so no
      logic is lost.
      ccf86aa5797c
    • Anton Shestakov's avatar
      hgweb: use strict equals, remove non-breaking space in followlines.js · 9f44d44626a0
      Anton Shestakov authored
      The first hunk had a non-breaking space character just before "{", it's not an
      error or anything, but let's fix it while we're at it. (This corresponds to
      "nonbsp" option of jshint).
      
      Hunks 2 and 3 change "==" (equals operator) to "===" (strict equals operator).
      The difference between them is that the latter doesn't do any type coercions.
      It's handy to compare string '1' to number 1 sometimes, but most of the time
      using "==" is inadvertent and can be replaced by an explicit type conversion.
      (This corresponds to "eqeqeq" option of jshint).
      
      Most of this file already uses strict equals operator, and in the code affected
      type coercion is not needed, because tagName and selectableTag are both strings
      and endId and startId are both numbers.
      9f44d44626a0
  8. Nov 29, 2017
  9. Nov 30, 2017
    • Anton Shestakov's avatar
      tests: move JSON escape test to test-hgweb-json.t · d2eff9d4db3f
      Anton Shestakov authored
      The original tests (kanji and null) in test-hgweb-commands.t come from
      aff419e260f9 and 823a7d79ef82, but they check json escape filter by using
      JavaScript variable on /graph page, which is awkward, and I'm planning to
      remove commit description from this variable soon. Let's move the parts that
      check json template filter to a more appropriate file and use normal json-*
      templates.
      d2eff9d4db3f
  10. Nov 29, 2017
  11. Nov 28, 2017
  12. Nov 29, 2017
  13. Nov 21, 2017
    • Matt Harbison's avatar
      test-lfs: allow the test server to be killed on Windows · 32bb27dd5282
      Matt Harbison authored
      Apparently '$!' doesn't return a Win32 PID, so the process was never killed, and
      the next run was screwed up.  Oddly, without the explicit killdaemons.py at the
      end, the test seems to hang.  This spawning is just sad, so I limited it to
      Windows.
      32bb27dd5282
  14. Nov 15, 2017
  15. Nov 21, 2017
    • Anton Shestakov's avatar
      hgweb: show changeset age in more places (gitweb and monoblue) · e397f8585953
      Anton Shestakov authored
      mercurial.js has a process_dates() function that calculates relative age for a
      given date, it works for all elements with "age" css class. If those elements
      also have "date" css class, the original text is preserved and age is added at
      the end.
      
      This patch adds these two css classes in some pages in gitweb and monoblue that
      weren't already using this feature.
      e397f8585953
  16. Nov 19, 2017
    • Boris Feld's avatar
      obsolete: drop usage of changectx in '_computecontentdivergentset' · 5cd6682b5a90
      Boris Feld authored
      Changectx are expensive and not needed there. The use of `repo.set` denote old
      code that predate the introduction of `repo.revs` that we now use.
      
      On my mercurial repository 495 draft:
      
          before: 0.054239 second
          after:  0.046935 second
      
      On a mercurial repository with 115973 draft:
      
          before: 0.564548 second
          after:  0.130534 second
      5cd6682b5a90
    • Boris Feld's avatar
      obsolete: drop usage of changectx in '_computephasedivergentset' · 82680919d75e
      Boris Feld authored
      Changectx are expensive and not needed there. The use of `repo.set` denote old
      code that predate the introduction of `repo.revs` that we now use.
      
      On my mercurial repository 495 draft:
      
          before: 0.010275 second
          after:  0.008832 second
      
      On a mercurial repository with 115973 draft:
      
          before: 0.899255 second
          after:  0.397131 second
      82680919d75e
  17. Nov 25, 2017
  18. Nov 26, 2017
Loading