Skip to content
Snippets Groups Projects
  1. Jul 08, 2017
    • Jun Wu's avatar
      rebase: use scmutil.cleanupnodes (issue5606) (BC) · 3b7cb3d17137
      Jun Wu authored
      This patch migrates rebase to use scmutil.cleanupnodes API. It simplifies
      the code and makes rebase code reusable inside a transaction.
      
      This is a BC because the backup file is no longer strip-backup/*-backup.hg,
      but strip-backup/*-rebase.hg. The latter looks more reasonable since the
      directory name is "strip-backup" so there is no need to repeat "backup".
      
      I think the backup file name change is probably fine as a BC, since we have
      changed it before (aa4a1672583e) and didn't get complains. The end result
      of this series will be a much more consistent and unified backup names:
      
        command  | old backup file suffix       | new backup file suffix
        -------------------------------------------------------------------
        amend    | amend-backup.hg              | amend.hg
        histedit | backup.hg (could be 2 files) | histedit.hg (single file)
        rebase   | backup.hg                    | rebase.hg
        strip    | backup.hg                    | backup.hg
      
      (note: backup files are under .hg/strip-backup)
      
      It also fixes issue5606 as a side effect because the new "delayedstrip" code
      path will carefully examine nodes (safestriproots) to make sure orphaned
      changesets won't get stripped by accident.
      
      Some warning messages are changed to the new "warning: orphaned descendants
      detected, not stripping HASHES", which provides more information about
      exactly what changesets are left behind.
      
      Another minor behavior change is when there is an obsoleted changeset with a
      successor in the destination branch, bookmarks pointing to that obsoleted
      changeset will not be moved. I have commented in test-rebase-obsolete.t
      explaining why that is more desirable.
      3b7cb3d17137
  2. Jun 26, 2017
    • Jun Wu's avatar
      scmutil: make cleanupnodes delete divergent bookmarks · 4bae3c117b57
      Jun Wu authored
      cleanupnodes takes care of bookmark movement, and bookmark movement could
      cause bookmark divergent resolution as a side effect. This patch adds such
      bookmark divergent resolution logic so future rebase migration will be
      easier.
      
      The revset is carefully written to be equivalent to what rebase does today.
      Although I think it might make sense to remove divergent bookmarks more
      aggressively, for example:
      
          F   book@1
          |
          E   book@2
          |
          | D book
          | |
          | C
          |/
          B   book@3
          |
          A
      
      When rebase -s C -d E, "book@1" will be removed, "book@3" will be kept,
      and the end result is:
      
          D   book
          |
          C
          |
          F
          |
          E   book@2 (?)
          |
          B   book@3
          |
          A
      
      The question is should we keep book@2? The current logic keeps it. If we
      choose not to (makes some sense to me), the "deleterevs" revset could be
      simplified to "newnode % oldnode".
      
      For now, I just make it compatible with the existing behavior. If we want to
      make the "deleterevs" revset simpler, we can always do it in the future.
      4bae3c117b57
    • Jun Wu's avatar
      scmutil: make cleanupnodes handle filtered node · ba43e5ee9c6d
      Jun Wu authored
      In some valid usecases, the "mapping" received by scmutil.cleanupnodes have
      filtered nodes. Use unfiltered repo to access them correctly.
      
      The added test case will fail with the old cleanupnodes code.
      
      This is important to migrate histedit to use the cleanupnodes API.
      ba43e5ee9c6d
  3. Jul 07, 2017
    • David Demelier's avatar
      configitems: add alias support in config · e714159860fd
      David Demelier authored
      Aliases define optional alternatives to existing options. For example the old
      option ui.user was deprecated and replaced by ui.username. With this mechanism,
      it's even possible to create an alias to an option in a different section.
      
      Add ui.user as alias to ui.username as an example of this concept.
      
      The old alternates principle in ui.config is removed as it was used only for
      this option.
      e714159860fd
  4. Jul 03, 2017
  5. Jul 07, 2017
    • Martin von Zweigbergk's avatar
      dispatch: fix typo suggestion for disabled extension · 68b7ceda99d7
      Martin von Zweigbergk authored
      If the matching command lives in an in-tree extension (which is all we
      scan for), and the user has disabled that extension with
      "extensions.<name>=!", we were not finding it, because the path in
      _disabledextensions was the empty string. If the user had set
      "extensions.<name>=!<valid path>" it would work, so it seems like just
      a mistake that it didn't work.
      68b7ceda99d7
    • Martin von Zweigbergk's avatar
      tests: add tests for typoed commands · 67b42e64194d
      Martin von Zweigbergk authored
      This includes one test showing how disabling a command with e.g.
      "extensions.rebase=!" results in the command not being
      suggested. We'll fix that next.
      67b42e64194d
  6. Jul 06, 2017
    • Gregory Szorc's avatar
      sparse: inline signature cache clearing · 38df146d0697
      Gregory Szorc authored
      It is a trivial one-liner. No need to have a separate function.
      38df146d0697
    • Gregory Szorc's avatar
      sparse: move working directory refreshing into core · 33d0859c37bd
      Gregory Szorc authored
      This is a pretty straightforward move of the code.
      
      I converted the "force" argument to a keyword argument.
      
      Like other recent changes, this code is tightly coupled with
      working directory update code in merge.py. I suspect the code
      will become more tightly coupled over time, possibly even moved
      to merge.py. For now, let's get the code in core.
      33d0859c37bd
    • Gregory Szorc's avatar
      sparse: refactor update actions filtering and call from core · 252500520d60
      Gregory Szorc authored
      merge.calculateupdates() now filters the update actions through sparse
      by default.
      
      The filtering no-ops if sparse isn't enabled or no sparse config
      is defined.
      
      The function has been refactored to behave more like a filter
      instead of a wrapper of merge.calculateupdates().
      
      We should arguably take sparse into account earlier in
      merge.calculateupdates(). This patch preserves the old behavior
      of applying sparse at the end of update calculation, which is the
      simplest and safest approach.
      252500520d60
    • Gregory Szorc's avatar
      sparse: move update action filtering into core · fa6c2c3064fd
      Gregory Szorc authored
      This is a relatively straight port of the function. It is pretty large.
      So refactoring will be postponed to a subsequent commit.
      fa6c2c3064fd
    • Gregory Szorc's avatar
      sparse: move pruning of temporary includes into core · d09e948dc303
      Gregory Szorc authored
      This was our last method on the custom repo type, meaning we could
      remove that custom type and inline the 2 lines of code into
      reposetup().
      
      As part of the move, instead of wrapping merge.update() from
      the sparse extension, we inline the function call. The ported
      function now no-ops if sparse isn't enabled, making it safe to
      always call.
      
      The call site in update() may not be the most appropriate. But
      it matches the previous behavior, which is the safest thing
      to do. It can be improved later.
      d09e948dc303
  7. Jul 07, 2017
    • Gregory Szorc's avatar
      sparse: move function for resolving sparse matcher into core · 153456f02426
      Gregory Szorc authored
      As part of the move, the function arguments changed so revs are
      passed as a list instead of *args. This allows us to use keyword
      arguments properly.
      
      Since the plan is to integrate sparse into core and have it
      enabled by default, we need to prepare for a sparse matcher
      to always be obtained and operated on. As part of the move,
      we inserted code that returns an always matcher if sparse
      isn't enabled. Some callers in the sparse extension take this
      into account and conditionally perform matching depending on
      whether the special always matcher is seen. I /think/ this
      may have sped up some operations where the extension is
      installed but no sparse config is activated.
      
      One thing I'm ensure of in this code is whether os.path.dirname()
      is semantically correct. os.posixpath.dirname() (which is
      exported as pathutil.dirname) might be a better choise because
      all patterns should be using posix directory separators (/)
      instead of Windows (\). There's an inline comment that implies
      Windows was tested. So hopefully it won't be a problem. We
      can improve this in a follow-up. I've added a TODO to track it.
      153456f02426
    • Gregory Szorc's avatar
      match: move matchers from sparse into core · 3c84591e7321
      Gregory Szorc authored
      The sparse extension contains some matcher types that are
      generic and can exist in core.
      
      As part of the move, the classes now inherit from basematcher.
      always(), files(), and isexact() have been dropped because
      they match the default implementations in basematcher.
      3c84591e7321
  8. Jul 06, 2017
    • Gregory Szorc's avatar
      sparse: clean up config signature code · 526255fe7899
      Gregory Szorc authored
      Before, 0 was being used as the default signature value and we cast
      the int to a string. We also handled I/O exceptions manually.
      
      The new code uses cfs.tryread() so we always feed data into the
      hasher. The empty string does hash and and should be suitable
      for input into a cache key.
      
      The changes made the code simple enough that the separate checksum
      function could be inlined.
      526255fe7899
    • Gregory Szorc's avatar
      sparse: move config signature logic into core · df1287268cc0
      Gregory Szorc authored
      This is a pretty straightforward port. It will be cleaned up in
      a subsequent commit.
      df1287268cc0
  9. Jul 07, 2017
    • Gregory Szorc's avatar
      sparse: remove custom hash matcher · 310f7bcab50b
      Gregory Szorc authored
      With the recent change to always use repr(), this function was
      functionally identical to the version in fsmonitor it was
      replacing. So remove it.
      310f7bcab50b
  10. Jul 06, 2017
    • Martin von Zweigbergk's avatar
      sparse: override __repr__ in matchers · d2d4b210a040
      Martin von Zweigbergk authored
      sparse.py in FB's hg-experimental repo switched to using __repr__ for
      non-sparse matchers soon after hg core started overriding __repr__ in
      the matchers in match.py (because the core matchers also stopped
      having "includepat" and other attributes that sparse used to depend
      on). Let's finish that migration by implementing __repr__ in the
      sparse matchers as well. That also lets us remove the special handling
      of them in _hashmatcher().
      d2d4b210a040
    • Martin von Zweigbergk's avatar
      tests: fix reference to undefined variable · 7d8d2da4516c
      Martin von Zweigbergk authored
      The delaypush() function had a reference to "repo" that was clearly
      supposed to be "pushop.repo". Instead of just fixing that, let's
      extract "pushop.repo.ui" to a variable, since that's the only
      piece of the repo that's needed in the function.
      
      I have not looked into why I saw a different result in the test to
      start with, but that's for another patch anyway.
      7d8d2da4516c
  11. Dec 01, 2015
  12. Nov 23, 2015
  13. Dec 01, 2015
  14. Jul 01, 2017
    • Martin von Zweigbergk's avatar
      changegroup: don't fail on empty changegroup (API) · 69c4493a54f9
      Martin von Zweigbergk authored
      I don't know why applying an empty changegroup should be an error. It
      seems harmless. I suspect the check was there to find code that
      creates empty changegroups just because that would be wasteful. Let's
      use develwarn() for that instead, so we catch any such cases that run
      with our test runner, but we still allow others to generate empty
      changegroups if they want to.
      
      We have run into this check at Google once or twice and had to work
      around it, but I'm changing this not so much because of that, but
      because it seems like it shouldn't be an error.
      
      I also changed the message slightly to be more modern ("changelog
      group" -> "changegroup") and more generic ("received" -> "applied").
      69c4493a54f9
    • Martin von Zweigbergk's avatar
      changegroup: remove option to allow empty changegroup (API) · 248d5890c80a
      Martin von Zweigbergk authored
      No caller sets the "emptyok" option, so let's remove it.
      248d5890c80a
    • Martin von Zweigbergk's avatar
      strip: don't allow empty changegroup in bundle1 · 665271d601f5
      Martin von Zweigbergk authored
      Applying an empty changegroup has been an error since the
      beginning. The only exception was strip, which would allow to apply an
      empty changegroup from the temporary bundle. However, the emptyok=True
      option was only set for bundle1 bundles. In other words, temporary
      bundle2 bundles would fail if they were empty.
      
      Bundle2 has now been used enough that it seems safe to say that we
      simply don't create bundle2 bundles with empty changegroups. That also
      suggests that we never create bundle1 bundles with empty changegroups
      (i.e. empty bundle1 bundles, since bundle1 is just a changegroup),
      because, AFAICT, the code leading up to the application of the bundle
      is the same for bundle1 and bundle2.
      
      Therefore, let's stop passing emptyok=True, so we more clearly get the
      same behavior for bundle1 and bundle2.
      665271d601f5
  15. Jun 09, 2017
  16. Jul 06, 2017
    • Boris Feld's avatar
      aaa1f8f514cf
    • Gregory Szorc's avatar
      sparse: move some temporary includes functions into core · 3e1accab7447
      Gregory Szorc authored
      Functions for reading and writing the tempsparse file have been
      moved. prunetemporaryincludes() will be moved separately
      because it is non-trivial.
      3e1accab7447
    • Gregory Szorc's avatar
      sparse: move config file writing into core · 8b571495d811
      Gregory Szorc authored
      The code was refactored during the move to be more procedural
      instead of using string formatting. This has the benefit of not
      writing empty sections, which changed tests.
      8b571495d811
    • Gregory Szorc's avatar
      localrepo: add sparse caches · 36a415b5a4b2
      Gregory Szorc authored
      The sparse extension maintains caches for the sparse files
      to a signature and a signature to a matcher. This allows the
      sparse matchers to be resolved quickly, which is apparently
      something that can occur in loops.
      
      This patch ports the sparse caches to the localrepo class
      pretty much as-is. There is potentially room to improve the
      caching mechanism. But that can be done as a follow-up.
      
      The default invalidatecaches() now clears the relevant sparse
      cache. invalidatesignaturecache() has been moved to sparse.py.
      36a415b5a4b2
    • Gregory Szorc's avatar
      sparse: move active profiles function into core · ca4b78eb11e7
      Gregory Szorc authored
      Also includes some light formatting changes.
      ca4b78eb11e7
    • Gregory Szorc's avatar
      sparse: move resolving of sparse patterns for rev into core · f7a106b3f089
      Gregory Szorc authored
      This method is reasonably well-contained and simple to move.
      
      As part of the move, some light formatting was performed.
      
      A "working copy" reference in an error message was changed to
      "working directory."
      
      The biggest change was to _refreshoncommit() in sparse.py. It
      was previously checking for the existence of an attribute on
      the repo instance. Since the moved function now returns empty
      data if sparse isn't enabled, we unconditionally call the
      new function. However, we do have to protect another method
      call in that function. This will all be unhacked eventually.
      f7a106b3f089
    • Gregory Szorc's avatar
      sparse: variable to track if sparse is enabled · 41448fc51510
      Gregory Szorc authored
      Currently, the sparse extension sniffs repo instances for
      attributes defined by the sparse extension to determine if
      sparse is enabled. As we move code away from repo instances,
      these checks will be a bit more brittle.
      
      We introduce a module-level variable to track whether sparse is
      enabled as a temporary workaround.
      41448fc51510
    • Gregory Szorc's avatar
      sparse: move profile reading into core · f41a99c45956
      Gregory Szorc authored
      One more step towards weaning off methods on repo instances and
      moving code to core. While this function is only used once and
      is simple, it needs to exist on its own so Facebook can monkeypatch
      it to enable simplecache integration.
      f41a99c45956
    • Gregory Szorc's avatar
      sparse: move config parsing into core · ba5d89774db6
      Gregory Szorc authored
      This patch marks the beginning of moving code from the sparse
      extension into core. The goal is to move as much of the
      functionality as possible into core, where it will be an
      experimental feature. The extension will likely continue to
      exist to enable the feature and provide UI elements.
      
      As part of the move, the repo method was converted to a module
      function. It doesn't need to exist on repos.
      
      An error message was also updated to reflect that an error isn't
      necessarily from the .hg/sparse file. The API should be updated
      later to pass in a filename so the error can be more descriptive.
      
      Copyright of the added file was copied from the sparse extension.
      ba5d89774db6
    • Gregory Szorc's avatar
      sparse: use vfs.tryread() · ee616196227c
      Gregory Szorc authored
      vfs.exists() followed by a file read is an anti-pattern because it
      incurs an extra stat() to test for file presence. vfs.tryread()
      returns empty string on missing file and avoids the stat().
      ee616196227c
  17. Jul 01, 2017
    • Gregory Szorc's avatar
      sparse: refactor sparsechecksum() · c72e9c61d2b1
      Gregory Szorc authored
      This was relying on garbage collection to close the opened
      file, which is a bug. Both callers simply called into self.vfs
      to resolve the path. So refactor to use the vfs layer.
      
      While we're here, rename the method to reflect it is internal
      and to break anyone relying on the old behavior.
      c72e9c61d2b1
  18. Jul 06, 2017
  19. Jul 01, 2017
    • Gregory Szorc's avatar
      sparse: rename command to debugsparse · c9cbf4de27ba
      Gregory Szorc authored
      Sparse checkout is still highly experimental and not protected
      by BC guarantees yet. We also haven't had a discussion on the UX.
      
      To discourage use, we rename the sparse command to debugsparse.
      c9cbf4de27ba
Loading