Skip to content
Snippets Groups Projects
  1. Feb 22, 2025
  2. Dec 22, 2024
    • Felipe Resende's avatar
      subrepo: fix calling outgoing with multiple paths · 85c095c1f8bc
      Felipe Resende authored
      When recursing into a subrepository all the paths were being passed on to them.
      However, each subrepository is mapped to only one destination (subrepository
      state uses the destination to derive the final path). The for loop is
      responsible for recursing into the subrepository for each destination so we
      only need to pass the current destination.
      
      If we have the following repository structure parent/sub/sub_sub, and call
      outgoing to parent_p1 and parent_p2, the outgoing method will be called with
      the following arguments:
      
      dests = (parent_p1, parent_p2), subpath = None
      dests = (parent_p1 path.loc, ), subpath = sub
      dests = (parent_p1 path.loc, ), subpath = sub/sub_sub
      dests = (parent_p2 path.loc, ), subpath = sub
      dests = (parent_p2 path.loc, ), subpath = sub/sub_sub
      
      Then, the subrepositories absolute path will be formed concatenating both
      arguments. If subpath is absolute, dests is ignored.
      85c095c1f8bc
  3. Dec 29, 2024
  4. Dec 04, 2021
  5. Dec 03, 2021
  6. Nov 19, 2021
    • Pierre-Yves David's avatar
      dirstate: remove need_delay logic · 434de12918fd
      Pierre-Yves David authored
      Now that all¹ stored mtime are non ambiguous, we no longer need to apply the `need_delay` step.
      The need delay logic was not great are mtime gathered during longer operation
      could be ambiguous but younger than the `dirstate.write` call time.
      
      So, we don't need that logic anymore and can drop it
      
      This make the code much simpler. The code related to the test extension faking
      the dirstate write is now obsolete and associated test will be migrated as
      follow up. They currently do not break.
      
      [1] except the ones from `hg update`, but `need_delay` no longer help for them
      either.
      
      Differential Revision: https://phab.mercurial-scm.org/D11796
      434de12918fd
  7. Oct 28, 2021
    • Pierre-Yves David's avatar
      dirstate: use a single closure for get_flags · 91f07430db8c
      Pierre-Yves David authored
      The previous code was overlooking fallback when neither symlink not exec was
      supported.
      
      The number of "variants" is getting too high, so I am consolidating this in a
      single closure that should be easier to maintains.
      
      This also ensure that fallback flags are always taken into account.
      
      (they are not user code yet, but small experimentation shown that the feature
      was working as intended.)
      
      A a small side effect we need to check for symlink support more lazily and this
      show up in the test in a couple of places.
      
      Differential Revision: https://phab.mercurial-scm.org/D11728
      91f07430db8c
  8. Dec 08, 2020
  9. Nov 23, 2020
  10. Apr 10, 2020
  11. Oct 06, 2019
  12. Jul 12, 2019
  13. Jun 24, 2019
  14. Apr 12, 2019
  15. Mar 22, 2019
  16. Mar 14, 2019
    • Pierre-Yves David's avatar
      manifestcache: use `wcache` directory for manifest cache · e4ac7e63c213
      Pierre-Yves David authored
      The manifest full text cache is tightly related to the working copy. We should
      use the `wcache` directory for it, instead of the `cache`. Otherwise, multiple
      shares would keep overwriting each other cache entry and we loose its benefit.
      
      This is also more consistent with the fact this cache file is protected by
      `wlock`.
      e4ac7e63c213
  17. Feb 17, 2019
  18. Dec 04, 2018
  19. Nov 15, 2018
    • Boris Feld's avatar
      cache: create `wcache` directory at init time · d5622dfe4ba3
      Boris Feld authored
      The cache directory will be needed very quickly, so it seems simpler to create
      it early to make sure it has the same owner and permission than the other
      directory in the repository.
      d5622dfe4ba3
    • Boris Feld's avatar
      check-exec: write file in 'wcache' instead of 'cache' · 47e3f554df35
      Boris Feld authored
      Some cache are relevant or affected by the working copy used. So the `.hg/cache`
      directory is not the best place for them because multiple shared repository can
      end up fighting over them.
      
      To address this issue, we introduce a new 'wcache' directory to host this kind
      of cache.
      
      The first user are the `checkisexec` type file. These files describe property of
      the working copy and fit the use-case well.
      47e3f554df35
  20. Nov 16, 2018
    • Matt Harbison's avatar
      subrepo: print the status line before creating the peer for better diagnostics · 69d4c8c5c25e
      Matt Harbison authored
      I ran into a problem where I tried updating to a different branch, and the
      process appeared to hang.  It turned out that the subrepo revision wasn't
      available locally, and I must have originally cloned it from an `hg serve -S` on
      a machine that currently wasn't serving anything.  It took 2+ minutes to
      timeout, and didn't mention what it was connecting to even then.
      
      There are a couple of other issues in this scenario too.
      
        - The repo is dirty after the failed checkout because the top level repo is
          updated first.  We should probably make 2 passes- top down to pull
          everything needed, and then do an update once everything is in place.
      
        - Something must be reading .hgsubstate from wdir because if the same merge
          command is run after the timeout, a prompt is issued that the local and
          remote subrepo diverged, instead of hanging.  But it lists the local version
          and remote version as having the same hash.
      69d4c8c5c25e
  21. Aug 05, 2018
    • Yuya Nishihara's avatar
      formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC) · 34ba47117164
      Yuya Nishihara authored
      Note that {path} in status is either relative-to-cwd or repository-absolute
      depending on the command argument and config knob, which can't be reproduced
      by using the {path|relpath} filter. The default template is updated to always
      use a relative path.
      
      .. bc::
      
         ``{abspath}`` and ``{file}`` in generic templates are renamed to ``{path}``.
         Any ``{path}`` is a repository-absolute path. Use ``{path|relpath}`` to
         convert it to a filesystem path.
      34ba47117164
  22. Jun 19, 2018
  23. Jan 08, 2018
    • Pulkit Goyal's avatar
      merge: add `--abort` flag which can abort the merge · 41ef02ba329b
      Pulkit Goyal authored
      Currently we don't have a good functionality to abort the merge and tell user to
      do `hg update -C .` which can leads to different results if user missed the '.'
      and moreover does not align with other abort functionalities like rebase, shelve
      etc.
      
      This patch adds `hg merge --abort` which will abort the ongoing merge and take
      us back to the chagneset where we started from. Works in both cases when merge
      resulted in conflicts and when there were no conflicts.
      
      .. feature::
      
          A `--abort` flag to merge command to abort the ongoing merge.
      
      Differential Revision: https://phab.mercurial-scm.org/D1829
      41ef02ba329b
  24. Dec 11, 2017
    • Matt Harbison's avatar
      tests: remove (glob) annotations that were only for '\' matches · 4441705b7111
      Matt Harbison authored
      # skip-blame because this was mechanically rewritten the following script.  I
      ran it on both *.t and *.py, but none of the *.py changes were proper.  All *.t
      ones appear to be, and they run without addition failures on both Windows and
      Linux.
      
        import argparse
        import os
        import re
      
        ap = argparse.ArgumentParser()
        ap.add_argument('path', nargs='+')
        opts = ap.parse_args()
      
        globre = re.compile(r'^(.*) \(glob\)(.*)$')
      
        for p in opts.path:
            tmp = p + '.tmp'
            with open(p, 'rb') as src, open(tmp, 'wb') as dst:
                for line in src:
                    m = globre.match(line)
                    if not m or '$LOCALIP' in line or '*' in line:
                        dst.write(line)
                        continue
                    if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'):
                        dst.write(line)
                        continue
                    dst.write(m.group(1) + m.group(2) + '\n')
            os.unlink(p)
            os.rename(tmp, p)
      4441705b7111
  25. Nov 25, 2017
  26. Nov 07, 2017
    • Gregory Szorc's avatar
      subrepo: use per-type config options to enable subrepos · 1a314176da9c
      Gregory Szorc authored
      We change subrepos.allowed from a list of allowed subrepo types to
      a combination of a master switch and per-type boolean flag.
      
      If the master switch is set, subrepos can be disabled wholesale.
      
      If subrepos are globally enabled, then per-type options are
      consulted. Mercurial repos are enabled by default. Everything else
      is disabled by default.
      1a314176da9c
  27. Nov 05, 2017
    • Yuya Nishihara's avatar
      subrepo: extend config option to disable subrepos by type (SEC) · 828cf35f1de6
      Yuya Nishihara authored
      This allows us to minimize the behavior change introduced by the next patch.
      
      I have no idea which config style is preferred in UX POV, but I decided to
      get things done.
      
       a) list: 'allowed = hg, git, svn'
       b) sub option: 'allowed.hg = True' or 'allowed:hg = True'
       c) per-type action: 'hg = allow', 'git = abort'
      828cf35f1de6
    • Yuya Nishihara's avatar
      subrepo: add config option to reject any subrepo operations (SEC) · 5e27afeddaee
      Yuya Nishihara authored
      This is an alternative workaround for the issue5730.
      
      Perhaps this is the simplest way of disabling subrepo operations. It does
      nothing clever, but just aborts if Mercurial starts accessing to a subrepo.
      
      I think Greg's patch is more useful since it allows us to at least check
      out the parent repository. However, that would be confusing if the default
      is flipped to checkout=False and subrepos are silently ignored.
      
      I don't like the config name 'allowed', but I couldn't get any better name.
      5e27afeddaee
  28. Oct 16, 2017
    • Matt Harbison's avatar
      subrepo: share instead of clone if the parent repo is shared (issue5675) (BC) · 68e0bcb90357
      Matt Harbison authored
      Previously, only the top level repo was shared, and then any subrepos were
      cloned on demand.  This is problematic because commits to the parent repo would
      write an updated .hgsubstate to the share source, but the corresponding subrepo
      commit would be stuck in the local subrepo.  That would prevent an update in the
      source repo.  We already go to great lengths to avoid having inconsistent repos
      (e.g., `hg push -r rev` will push _everything_ in a subrepo, even if it isn't
      referenced in one of the parent's outgoing commits).  Therefore, this seems like
      a bug fix, and there's no option to get the old behavior.  I can't imagine the
      previous behavior was useful to anybody.
      
      There shouldn't be an issue with svn, since it is centralized.  Maybe --git-dir
      can be used for git subrepos, but I'll leave that to someone more familiar with
      git.
      
      An integer was previously being implicitly returned from commands.share(), which
      caused dispatch() to start crashing when changing over to returning the shared
      repo.  All error paths appear to raise, so this can be hardcoded to success.
      The clone command checks for 'is None' in a similar pattern, but since
      hg.clone() always returns a tuple, that seems wrong?
      
      .. fix:: Issue 5675
      
         Creating a share of a repository with a Mercurial subrepository will now
         share the subrepository.
      
      and
      
      .. bc::
      
         Mercurial subrepositories are now shared instead of cloned when the parent
         repository is shared.  This prevents dangling subrepository references in the
         share source.  Previously shared repositories with cloned subrepositories
         will continue to function unchanged.
      68e0bcb90357
  29. Oct 12, 2017
    • Denis Laxalde's avatar
      transaction-summary: show the range of new revisions upon pull/unbundle (BC) · eb586ed5d8ce
      Denis Laxalde authored
      Upon pull or unbundle, we display a message with the range of new revisions
      fetched. This revision range could readily be used after a pull to look out
      what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
      revisions that might be present in transaction's "changes" but should not be
      displayed to the end user.
      eb586ed5d8ce
  30. Aug 07, 2017
    • Yuya Nishihara's avatar
      ssh: unban the use of pipe character in user@host:port string · 3fee7f7d2da0
      Yuya Nishihara authored
      This vulnerability was fixed by the previous patch and there were more ways
      to exploit than using '|shellcmd'. So it doesn't make sense to reject only
      pipe character.
      
      Test cases are updated to actually try to exploit the bug. As the SSH bridge
      of git/svn subrepos are not managed by our code, the tests for non-hg subrepos
      are just removed.
      
      This may be folded into the original patches.
      4.3.1
      3fee7f7d2da0
  31. Jul 31, 2017
    • Sean Farley's avatar
      subrepo: add tests for hg rogue ssh urls (SEC) · 475af2f89636
      Sean Farley authored
      'ssh://' has an exploit that will pass the url blindly to the ssh
      command, allowing a malicious person to have a subrepo with
      '-oProxyCommand' which could run arbitrary code on a user's machine. In
      addition, at least on Windows, a pipe '|' is able to execute arbitrary
      commands.
      
      When this happens, let's throw a big abort into the user's face so that
      they can inspect what's going on.
      475af2f89636
  32. Jul 09, 2017
    • Matt Harbison's avatar
      subrepo: make the output references to subrepositories consistent · 6d88468d435b
      Matt Harbison authored
      Well, mostly.  The annotation on subrepo functions tacks on a parenthetical to
      the abort message, which seems reasonable for a generic mechanism.  But now all
      messages consistently spell out 'subrepository', and double quote the name of
      the repo.  I noticed the inconsistency in the change for the last commit.
      6d88468d435b
  33. Jun 06, 2017
  34. Jun 05, 2017
  35. May 25, 2017
  36. Apr 02, 2017
Loading