Skip to content
Snippets Groups Projects
  1. Dec 01, 2016
  2. Nov 25, 2016
  3. Nov 14, 2016
  4. Nov 12, 2016
    • Katsunori FUJIWARA's avatar
      scmutil: ignore EPERM at os.utime, which avoids ambiguity at closing · e0ff4799
      Katsunori FUJIWARA authored
      According to POSIX specification, just having group write access to a
      file causes EPERM at invocation of os.utime() with an explicit time
      information (e.g. working on the repository shared by group access
      permission).
      
      To ignore EPERM at closing file object in such case, this patch makes
      checkambigatclosing._checkambig() use filestat.avoidambig() introduced
      by previous patch.
      
      Some functions below imply this code path at truncation of an existing
      (= might be owned by another user) file.
      
        - strip() in repair.py, introduced by e38d85be978f
        - _playback() in transaction.py, introduced by 599912a62ff6
      
      This is a variant of issue5418.
      e0ff4799
    • Katsunori FUJIWARA's avatar
      vfs: ignore EPERM at os.utime, which avoids ambiguity at renaming (issue5418) · bff5ccbe
      Katsunori FUJIWARA authored
      According to POSIX specification, just having group write access to a
      file causes EPERM at invocation of os.utime() with an explicit time
      information (e.g. working on the repository shared by group access
      permission).
      
      To ignore EPERM at renaming in such case, this patch makes
      vfs.rename() use filestat.avoidambig() introduced by previous patch.
      bff5ccbe
    • Katsunori FUJIWARA's avatar
      util: add utility function to skip avoiding file stat ambiguity if EPERM · b496a464
      Katsunori FUJIWARA authored
      Now, advancing stat.st_mtime by os.utime() is used to avoid file stat
      ambiguity. But according to POSIX specification, utime(2) with an
      explicit time information is permitted only for a process with:
      
        - the effective user ID equal to the user ID of the file, or
        - appropriate privileges
      
        http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html
      
      Therefore, just having group write access to a file causes EPERM at
      applying os.utime() on it (e.g. working on the repository shared by
      group access permission).
      
      This patch adds class filestat utility function avoidamgig() to avoid
      file stat ambiguity but skip it if EPERM.
      
      It is reasonable to always ignore EPERM, because utime(2) causes EPERM
      only in the case described above (EACCES is used only for utime(2)
      with NULL).
      b496a464
  5. Nov 05, 2016
    • Gregory Szorc's avatar
      hgweb: cache fctx.parents() in annotate command (issue5414) · 4ed8bb8a
      Gregory Szorc authored
      9c37df347485 introduced a call to fctx.parents() for each line in
      annotate output. This function call isn't cheap, as it requires
      linkrev adjustment.
      
      Since multiple lines in annotate output tend to belong to the same
      file revision, a cache of fctx.parents() lookups for each input
      should be effective in the common case. So we implement one.
      
      Since the cache has to precompute parents so an aborted generator
      doesn't leave an incomplete cache, we could just return a list.
      However, we preserve the generator for backwards compatibility.
      
      The effect of this change when requesting /annotate/96ca0ecdcfa/
      browser/locales/en-US/chrome/browser/downloads/downloads.dtd on
      the mozilla-aurora repo is significant:
      
      p1(9c37df347485)  5.5s
      9c37df347485:    66.3s
      this patch:      10.8s
      
      We're still slower than before. But only by ~2x instead of ~12x.
      
      On the tip revisions of layout/base/nsCSSFrameConstructor.cpp file in
      the mozilla-unified repo, time went from 12.5s to 14.5s and back to
      12.5s. I'm not sure why the mozilla-aurora repo is so slow.
      
      Looking at the code of basefilectx.parents(), there is room for
      further improvements. Notably, we still perform redundant calls to
      filelog.renamed() and basefilectx._parentfilectx(). And
      basefilectx.annotate() also makes similar calls, so there is potential
      for object reuse. However, introducing caches here are not appropriate
      for the stable branch.
      4ed8bb8a
  6. Nov 01, 2016
  7. Oct 31, 2016
  8. Nov 01, 2016
    • Katsunori FUJIWARA's avatar
      contrib: check reference to old selenic.com domain · b4c0f8d5
      Katsunori FUJIWARA authored
      Now, all URL in Mercurial source tree should refer mercurial-scm.org
      domain instead of selenic.com.
      
      *.po files are ignored in this patch, because they might contain
      msgid/msgstr coming from old source files.
      
      This ignorance seems safe enough, because such msgstr should be
      ignored at runtime, because:
      
        - msgid corresponded to it should be invalid, or
        - msgstr itself should be marked as fuzzy at synchronized to recent hg.pot
      
      If any additional examination for *.po files is needed in the future,
      let i18n/check-translation.py achieve such examination.
      
      BTW, some binary files (e.g. *.png) are meaningless for checking
      reference to old domain in this patch, but aren't ignored like as *.po
      files, because excluding multiple suffixes is difficult for regexp
      matching.
      b4c0f8d5
    • Katsunori FUJIWARA's avatar
      check-code: discard filtering result of previous check for independence · 01703a8b
      Katsunori FUJIWARA authored
      Before this patch, check-code.py applies filtering on the file
      content, to which filtering of previous check is already applied.
      
      This might hide issues, which should be detected by a subsequent check
      in "checks" list.
      
      Fortunately, this problem hasn't appeared, because there is no
      overlapping of filename matching (examined in the order below).
      
        1. *.py or *.cgi
        2. test-* (not *.t suffix)
        3. *.c or *.h
        4. *.t
        5. *.txt
        6. *.tmpl
      
      For example, adding a test, which wants to examine raw comment text in
      *.py files, at the end of current "checks" list doesn't work as
      expected, because a filter for *.py files normalizes comment text in
      them.
      
      Putting such test at the beginning of "checks" list also resolves this
      problem, but such dependence on the order decreases maintainability of
      check-code.py itself.
      
      This patch discards filtering result of previous check at the
      beginning of each checks, for independence of each checks.
      01703a8b
    • Katsunori FUJIWARA's avatar
      help: replace selenic.com by mercurial-scm.org in man pages · 4e934804
      Katsunori FUJIWARA authored
      Source code repository and mailing list services have been already
      migrated to mercurial-scm.org domain.
      4e934804
    • Katsunori FUJIWARA's avatar
      help: replace selenic.com by mercurial-scm.org in command examples · 7b7bd704
      Katsunori FUJIWARA authored
      Source code repository service of Mercurial itself has been already
      migrated to mercurial-scm.org domain.
      7b7bd704
    • Yuya Nishihara's avatar
      hghave: fix 'rmcwd' to ensure temporary directory is removed · 389cbfe6
      Yuya Nishihara authored
      On platforms where cwd can't be removed, it should try rmdir() after chdir
      to the original cwd.
      389cbfe6
  9. Oct 31, 2016
    • Mads Kiilerich's avatar
      httppeer: make __del__ access to self.urlopener more safe · cac4ca03
      Mads Kiilerich authored
      Some errors could in some cases show unfortunate scary and confusing warnings
      from the httppeer delstructors:
      
        abort: nodename nor servname provided, or not known
        Exception AttributeError: "'httpspeer' object has no attribute 'urlopener'" in <bound method httpspeer.__del__ of <mercurial.httppeer.httpspeer object at 0x106e1f5d0>> ignored```
      
      To mute that, take 7b15dd9125b3 to the next level and use getattr in __del__.
      cac4ca03
  10. Oct 29, 2016
  11. Oct 28, 2016
    • Katsunori FUJIWARA's avatar
      tests: add test-commit-interactive-curses.t "require tic" for test portability · 141cb12c
      Katsunori FUJIWARA authored
      Standard library of Python on Windows doesn't have curses module.
      141cb12c
    • Katsunori FUJIWARA's avatar
      tests: use "?" to glob both ":" and ";" in output for test portability · fe612ab5
      Katsunori FUJIWARA authored
      If environment variable looks like PATH or so (e.g. any of components
      joined by ":" contains "/"), ":" in it is replaced with ";" by MinGW
      at spawning Windows native process, to follow path concatenation style
      of Windows.
      
      Therefore, "bundle:../full.hg" is converted into "bundle;..\full.hg"
      on MinGW.
      
      Difference between "/" and "\" is automatically ignored by "(glob)",
      but difference between ":" and ";" should be globed explicitly.
      fe612ab5
    • Katsunori FUJIWARA's avatar
      tests: invoke printenv.py via sh -c for test portability · 34a5f6c6
      Katsunori FUJIWARA authored
      On Windows platform, invoking printenv.py directly via hook is
      problematic, because:
      
        - unless binding between *.py suffix and python runtime, application
          selector dialog is displayed, and running test is blocked at each
          printenv.py invocations
      
        - it isn't safe to assume binding between *.py suffix and python
          runtime, because application binding is easily broken
      
          For example, installing IDE (VisualStudio with Python Tools, or
          so) often requires binding between source files and IDE itself.
      
      This patch invokes printenv.py via sh -c for test portability. This is
      a kind of follow up for d19787db6fe0, which eliminated explicit
      "python" for printenv.py. There are already other 'sh -c "printenv.py"'
      in *.t files, and this fix should be reasonable.
      
      This changes were confirmed in cases below:
      
        - without any application binding for *.py suffix
        - with binding between *.py suffix and VisualStudio
      
      This patch also replaces "echo + redirection" style with "heredoc"
      style, because:
      
        - hook command line is parsed by cmd.exe as shell at first, and
        - single quotation can't quote arguments on cmd.exe, therefore,
        - "printenv.py foobar" should be quoted by double quotation, but
        - nested quoting (or tricky escaping) isn't readable
      34a5f6c6
  12. Oct 27, 2016
    • Mads Kiilerich's avatar
      largefiles: handle that a found standin file doesn't exist when removing it · 3afde791
      Mads Kiilerich authored
      I somehow ended up in a situation where hg crashed on an unlink I introduced in
      328545c7d8a1.
      
      I don't know how it happened and can't reproduce it. It seems like it only can
      happen when the file is removed between the time of check in a working
      directory context walk that finds a standin file, and the time of use when we
      try to remove it because the corresponding largefile doesn't exist.
      
      But better safe than sorry: replace the plain unlink with unlinkpath with
      ignoremissing=True. That will also remove remaining empty directories, which
      arguably is more correct.
      3afde791
  13. Oct 25, 2016
    • Yuya Nishihara's avatar
      templater: use unfiltered changelog to calculate shortest() at constant time · 362740e0
      Yuya Nishihara authored
      cl._partialmatch() can be pretty slow if hidden revisions are involved. This
      patch cancels the slowdown introduced by the previous patch by using an
      unfiltered changelog, which means shortest(node) isn't always the shortest.
      
      The result isn't perfect, but seems okay as long as shortest(node) is short
      enough to type and can be used as an identifier.
      
        (with hidden revisions)
        % hg log -R hg-committed -r0:20000 -T '{node|shortest}\n' --time > /dev/null
        (.^^) time: real 1.530 secs (user 1.480+0.000 sys 0.040+0.000)
        (.^)  time: real 43.080 secs (user 43.060+0.000 sys 0.030+0.000)
        (.)   time: real 1.680 secs (user 1.650+0.000 sys 0.020+0.000)
      362740e0
  14. Oct 23, 2016
    • Yuya Nishihara's avatar
      templater: do not use index.partialmatch() directly to calculate shortest() · 741e5d7f
      Yuya Nishihara authored
      cl.index.partialmatch() isn't a drop-in replacement for cl._partialmatch().
      It has no knowledge about hidden revisions, and it raises ValueError if a node
      shorter than 4 chars is given. Instead, use index.partialmatch() through
      cl._partialmatch(), which has no such problems and gives the identical result
      with/without --pure.
      
      The test output was sampled with --pure without this patch, which shows the
      most correct result. However, we'll need to switch to using an unfiltered
      changelog because _partialmatch() of a filtered changelog can be an order of
      magnitude slower.
      
        (with hidden revisions)
        % hg log -R hg-committed -r0:20000 -T '{node|shortest}\n' --time > /dev/null
        (.^)  time: real 1.530 secs (user 1.480+0.000 sys 0.040+0.000)
        (.)   time: real 43.080 secs (user 43.060+0.000 sys 0.030+0.000)
      741e5d7f
  15. Oct 26, 2016
  16. Oct 25, 2016
    • Gábor Stefanik's avatar
      merge: avoid superfluous filemerges when grafting through renames (issue5407) · 69ffbbe7
      Gábor Stefanik authored
      This is a fix for a regression introduced by the patches for issue4028.
      
      The test changes are due to us doing fewer _checkcopies searches now, which
      makes some test outputs revert to the pre-issue4028 behavior. That issue itself
      remains fixed, we only skip copy tracing for files where it isn't relevant.
      As a nice side effect, this makes copy detection much faster when tracing
      backwards through lots of renames.
      69ffbbe7
  17. Oct 19, 2016
    • Gábor Stefanik's avatar
      sslutil: guard against broken certifi installations (issue5406) · b9f7b0c1
      Gábor Stefanik authored
      Certifi is currently incompatible with py2exe; the Python code for certifi gets
      included in library.zip, but not the cacert.pem file - and even if it were
      included, SSLContext can't load a cacert.pem file from library.zip.
      This currently makes it impossible to build a standalone Windows version of
      Mercurial.
      
      Guard against this, and possibly other situations where a module with the name
      "certifi" exists, but is not usable.
      b9f7b0c1
  18. Oct 25, 2016
    • Mads Kiilerich's avatar
      revset: don't cache abstractsmartset min/max invocations infinitely · 5ee944b9
      Mads Kiilerich authored
      There was a "leak", apparently introduced in ab66c1dee405. When running:
      
          hg = hglib.open('repo')
          while True:
              hg.log("max(branch('default'))")
      
      all filteredset instances from branch() would be cached indefinitely by the
      @util.cachefunc annotation on the max() implementation.
      
      util.cachefunc seems dangerous as method decorator and is barely used elsewhere
      in the code base. Instead, just open code caching by having the min/max
      methods replace themselves with a plain lambda returning the result.
      5ee944b9
  19. Oct 24, 2016
  20. Oct 23, 2016
  21. Oct 18, 2016
    • Mads Kiilerich's avatar
      dirstate: fix debug.dirstate.delaywrite to use the new "now" after sleeping · ad56071b
      Mads Kiilerich authored
      It seems like the a regression has sneaked into debug.dirstate.delaywrite in
      6c6b48aca328. It would sleep until no files were modified "now" any more, but
      when writing the dirstate it would use the old "now" and still mark files as
      'unset' instead of recording the timestamp that would make the file show up as
      clean instead of unknown.
      
      Instead of getting a new "now" from the file system, we trust the computed end
      time as the new "now" and thus cause the actual modification time to be
      writiten to the dirstate.
      
      debug.dirstate.delaywrite is undocumented and only used in
      test-largefiles-update.t . All tests seems to work fine for me without
      debug.dirstate.delaywrite . Perhaps because it not really worked as intended
      without the fix in this patch, and code and tests thus have evolved to do fine
      without it? It could thus perhaps make sense to drop usage of this setting in
      the tests. That could speed the test up a bit.
      
      This functionality (or something very similar) can however apparently be very
      convenient in setups where checking dirty-ness is expensive - such as when
      using large files and have slow file filesystems or are CPU constrained. Now it
      works and we can try it. (But ideally, for the largefile use case, it should
      probably only delay lfdirstate writes - not ordinary dirstate.)
      ad56071b
  22. Oct 21, 2016
  23. Oct 19, 2016
    • Gregory Szorc's avatar
      commands: print security protocol support in debuginstall · 7b428b00
      Gregory Szorc authored
      Over the past week I've had to instruct multiple people to run
      Python code to query the ssl module to see what TLS protocol support
      is present. I think it would be useful for `hg debuginstall` to print
      this info to make it easier to access and debug why Mercurial is
      complaining about using an insecure TLS 1.0 protocol.
      
      Ideally we'd also print the path to the CA cert bundle. But the APIs
      for querying that in sslutil can emit warnings, making it slightly
      more difficult to integrate into `hg debuginstall`. That work will
      have to wait for another day.
      7b428b00
    • Durham Goode's avatar
      manifest: make treemanifestctx store the repo · f2c5b9d4
      Durham Goode authored
      Same as in the last commit, the old treemanifestctx stored a reference to the
      revlog.  If the inmemory revlog became invalid, the ctx now held an old copy and
      would be incorrect. To fix this, we need the ctx to go through the manifestlog
      for each access.
      
      This is the same pattern that changectx already uses (it stores the repo, and
      accesses commit data through self._repo.changelog).
      f2c5b9d4
    • Durham Goode's avatar
      manifest: make manifestctx store the repo · acc8885a
      Durham Goode authored
      The old manifestctx stored a reference to the revlog. If the inmemory revlog
      became invalid, the ctx now held an old copy and would be incorrect. To fix
      this, we need the ctx to go through the manifestlog for each access.
      
      This is the same pattern that changectx already uses (it stores the repo, and
      accesses commit data through self._repo.changelog).
      acc8885a
Loading