Skip to content
Snippets Groups Projects
  1. May 03, 2016
  2. Sep 19, 2016
    • Martin von Zweigbergk's avatar
      strip: don't use "full" and "partial" to describe bundles · 769aee32
      Martin von Zweigbergk authored
      The partial bundle is not a subset of the full bundle, and the full
      bundle is not full in any way that i see. The most obvious
      interpretation of "full" I can think of is that it has all commits
      back to the null revision, but that is not what the "full" bundle
      is. The "full" bundle is simply a backup of what the user asked us to
      strip (unless --no-backup). The "partial" bundle contains the
      revisions we temporarily stripped because they had higher revision
      numbers that some commit that the user asked us to strip.
      
      The "full" bundle is already called "backup" in the code, so let's use
      that in user-facing messages too. Let's call the "partial" bundle
      "temporary" in the code.
      769aee32
    • Martin von Zweigbergk's avatar
      strip: clarify that user action is required to recover temp bundle · 94ebf56d
      Martin von Zweigbergk authored
      If strip fails when applying the temporary bundle, the commits in the
      temporary bundle have not yet been applied, so the user will almost
      definitely want to apply the bundle. We should be more clear to the
      user about that than our current "partial bundle stored in...".
      
      Note that we will probably not be able to recover it automatically,
      since whatever made it fail (e.g. a hook) will most likely make it
      fail again. We need to give control back to the user to fix the
      problem before trying again.
      94ebf56d
  3. Sep 15, 2016
    • Martin von Zweigbergk's avatar
      strip: report both bundle files in case of exception (issue5368) · 44ef2162
      Martin von Zweigbergk authored
      If strip fails while recovering the temporary bundle (e.g. because a
      hook fails), we tell the user only about the backup bundle, not about
      the temporary bundle. Since the user did not ask to strip the commits
      in the temporary bundle, that's the more important bundle to mention,
      so let's do that (and also mention the backup bundle as usual).
      44ef2162
    • Martin von Zweigbergk's avatar
      strip: simplify some repeated conditions · e7acbe53
      Martin von Zweigbergk authored
      We check "if saveheads or savebases" in several places to see if we
      should or have created a bundle of the changesets to apply after
      truncating the revlogs. One of the conditions is actually just "if
      saveheads", but since there can't be savebases without saveheads, that
      is effectively the same condition. It seems simpler to check only once
      and from then on see if we created the file.
      e7acbe53
  4. Aug 29, 2016
    • Mathias De Maré's avatar
      config: add template support · 80fef525
      Mathias De Maré authored
      V2:
      - Limit escaping to plain formatting only
      - Use the formatter consistently (no more ui.debug)
      - Always include 'name' and 'value'
      
      V3:
      - Always convert 'value' to string (this also makes sure we handle functions)
      - Keep real debug message as ui.debug for now
      - Add additional tests.
        Note: I'm not quite sure about the best approach to handling
        the 'print the full config' case.
        For me, it printed the 'ui.promptecho' key at the end.
        I went with globs there as that at least tests the json display reliably.
      
      Example output:
      [
       {
        "name": "ui.username",
        "source": "/home/mathias/.hgrc:2",
        "value": "Mathias De Maré <mathias.demare@gmail.com>"
       }
      ]
      80fef525
    • Mathias De Maré's avatar
      formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API) · e7cacb45
      Mathias De Maré authored
      V2: also remove and replace __nonzero__
      e7cacb45
  5. Aug 30, 2016
    • Augie Fackler's avatar
      diffopts: notice a negated boolean flag in diffopts · e40343ce
      Augie Fackler authored
      This means that if you have git-diffs enabled by default (pretty
      common) and you hit the rare (but real) case where a git-diff breaks
      patch(1) or some other tool, you can easily disable it by just
      specifying --no-git on the command line.
      
      I feel a little bad about the isinstance() check, but some values in
      diffopts are not booleans and so we need to preserve false iff the
      flag is a boolean flag: failing to do this means we end up with empty
      string defaults for flags clobbering meaningful values from the [diff]
      section in hgrc.
      e40343ce
  6. Sep 14, 2016
    • Augie Fackler's avatar
      flags: allow specifying --no-boolean-flag on the command line (BC) · e1f0ec0b
      Augie Fackler authored
      This makes it much easier to enable some anti-foot-shooting features
      (like update --check) by default, because now all boolean flags can be
      explicitly disabled on the command line without having to use HGPLAIN
      or similar. Flags which don't deserve this treatment can be removed
      from consideration by adding them to the nevernegate set in fancyopts.
      
      This doesn't make it any easier to identify when a flag is set: opts
      still always gets filled in, either with the user-specified flag value
      or with the default from the flags list in the command
      table. Improving that would probably clean things up a bit, but for
      now if you want a boolean flag and care if it was explicitly false or
      default false (or true, but nobody uses that functionality because
      before now it was nonsense) you need to use None as your default
      rather than True or False.
      
      This doesn't (yet) update help output, because I'm not quite sure how
      to do that cleanly.
      e1f0ec0b
  7. May 03, 2016
  8. Jun 01, 2016
    • Yuya Nishihara's avatar
      revset: forward ordering requirement to argument of present() · 80c86b9b
      Yuya Nishihara authored
      present() is special in that it returns the argument set with no
      modification, so the ordering requirement should be forwarded.
      
      We could make present() fix the order like orset(), but that would be silly
      because we know the extra filtering cost is unnecessary.
      80c86b9b
  9. Sep 14, 2016
  10. Sep 13, 2016
    • Durham Goode's avatar
      manifest: move dirlog up to manifestrevlog · 1cc93a15
      Durham Goode authored
      This removes dirlog and its associated cache from manifest and puts it in
      manifestrevlog. The notion of there being sub-logs is specific to the revlog
      implementation, and therefore belongs on the revlog class.
      
      This patch will enable future patches to move the serialization logic for
      manifests onto manifestrevlog, which will allow us to move manifest.add onto
      manifestlog in a way that it just calls out to manifestrevlog for the
      serialization.
      1cc93a15
    • Durham Goode's avatar
      manifest: move revlog specific options from manifest to manifestrevlog · fa145a20
      Durham Goode authored
      The manifestv2 and treeondisk options are specific to how we serialize the
      manifest into revlogs, so let's move them onto the manifestrevlog class. This
      will allow us to add a manifestlog.add() function in a future diff that will
      rely on manifestrevlog to make decisions about how to serialize the given
      manifest to disk.
      
      We have to move a little bit of extra logic about the 'dir' as well, since it is
      used in conjunction with the treeondisk option to decide the revlog file name.
      It's probably good to move this down to the manifestrevlog class anyway, since
      it's specific to the revlog.
      fa145a20
    • Durham Goode's avatar
      manifest: adds manifestctx.readfast · 80be4436
      Durham Goode authored
      This adds a copy of manifest.readfast to manifestctx.readfast and adds a
      consumer of it. It currently looks like duplicate code, but a future patch
      causes these functions to diverge as tree concepts are added to the tree
      version.
      80be4436
    • Durham Goode's avatar
      manifest: add manifestctx.readdelta() · a059b173
      Durham Goode authored
      This adds an implementation of readdelta to the new manifestctx class and adds a
      couple consumers of it. This currently appears to have some duplicate code, but
      future patches cause this function to diverge when things like "shallow" are
      introduced.
      a059b173
  11. Sep 14, 2016
  12. Sep 13, 2016
  13. Jun 26, 2016
    • Yuya Nishihara's avatar
      revset: fix order of nested '_(|int|hex)list' expression (BC) · e34cd85d
      Yuya Nishihara authored
      This fixes the order of 'x & (y + z)' where 'y' and 'z' are trivial, and the
      other uses of _list()-family functions. The original functions are renamed to
      '_ordered(|int|hex)list' to say clearly that they do not follow the subset
      ordering.
      e34cd85d
    • Yuya Nishihara's avatar
      revset: fix order of nested 'or' expression (BC) · 2c6a05b9
      Yuya Nishihara authored
      This fixes the order of 'x & (y + z)' where 'y' and 'z' are not trivial.
      
      The follow-order 'or' operation is slower than the ordered operation if
      an input set is large:
      
             #0           #1           #2           #3
          0) 0.002968     0.002980     0.002982     0.073042
          1) 0.004513     0.004485     0.012029     0.075261
      
          #0: 0:4000 & (0:1099 + 1000:2099 + 2000:3099)
          #1: 4000:0 & (0:1099 + 1000:2099 + 2000:3099)
          #2: 10000:0 & (0:1099 + 1000:2099 + 2000:3099)
          #3: file("path:hg") & (0:1099 + 1000:2099 + 2000:3099)
      
      I've tried another implementation, but which appeared to be slower than
      this version.
      
          ss = [getset(repo, fullreposet(repo), x) for x in xs]
          return subset.filter(lambda r: any(r in s for s in ss), cache=False)
      2c6a05b9
  14. Aug 07, 2016
  15. Feb 16, 2016
    • Yuya Nishihara's avatar
      revset: infer ordering flag to teach if operation should define/follow order · 90455e7b
      Yuya Nishihara authored
      New flag 'order' is the hint to determine if a function or operation can
      enforce its ordering requirement or take the ordering already defined. It
      will be used to fix a couple of ordering bugs, such as:
      
       a) 'x & (y | z)' disregards the order of 'x' (issue5100)
       b) 'x & y:z' is listed from 'y' to 'z'
       c) 'x & y' can be rewritten as 'y & x' if weight(x) > weight(y)
      
      (a) and (b) are bugs of the revset core. Before this, there was no way to
      tell if 'orset()' and 'rangeset()' can enforce its ordering. These bugs
      could be addressed by overriding __and__() of the initial set to take the
      ordering of the other set:
      
          class fullreposet:
              def __and__(self, other):
                  # allow other to enforce its ordering
                  return other
      
      but it would expose (c), which is a hidden bug of optimize(). So, in either
      ways, optimize() have to know the current ordering requirement. Otherwise,
      it couldn't rewrite expressions by weights with no output change, nor tell
      how a revset function or operation should order the entries.
      
      'order' is tri-state. It starts with 'define', and shifts to 'follow' by
      'x & y'. It changes back to 'define' on function call 'f(x)' or function-like
      operation 'x (f) y' because 'f' may have its own ordering requirement for 'x'
      and 'y'. The state 'any' will allow us to avoid extra cost that would be
      necessary to constrain ordering where it isn't important, 'not x'.
      90455e7b
  16. Aug 07, 2016
    • Yuya Nishihara's avatar
      revset: wrap arguments of 'or' by 'list' node · b3845cab
      Yuya Nishihara authored
      This makes the number of 'or' arguments deterministic so we can attach
      additional ordering flag to all operator nodes. See the next patch.
      
      We rewrite the tree immediately after chained 'or' operations are flattened
      by simplifyinfixops(), so we don't need to care if arguments are stored in
      x[1] or x[1:].
      b3845cab
  17. Sep 13, 2016
    • Pierre-Yves David's avatar
      journal: properly check for held lock (issue5349) · e5a97ec6
      Pierre-Yves David authored
      The 'jlock' code meant to check for a held lock, but it actually just checking for a
      lock object. With CPython, this worked because the 'jlock' object is not
      referenced outside the '_write' function so reference counting would garbage
      collect it and the '_lockref' would return None. With pypy, the garbage
      collection would happen at an undefined time and the '_lockref' can still point
      to a 'jlock' object outside of '_write'.
      
      The right thing to do here is not only to check for a lock object but also to
      check if the lock is held. We update the code to do so and reuse a utility
      method that exist on 'localrepo' to help readability. This fix journal related
      tests with pypy.
      e5a97ec6
    • Pierre-Yves David's avatar
      ssl: handle a difference in SSLError with pypy (issue5348) · 799e3674
      Pierre-Yves David authored
      The SSLError exception is a bit different with pypy (message is the first
      argument, not the second) This led the certificate error handling to crash when
      trying to extract the ssl error message. We now handle this different and
      'test-https.t' is green again.
      799e3674
  18. Sep 12, 2016
    • Durham Goode's avatar
      manifest: change manifestctx to not inherit from manifestdict · be16091a
      Durham Goode authored
      If manifestctx inherits from manifestdict, it requires some weird logic to
      lazily load the dict if a piece of information is asked for. This ended up being
      complicated and unintuitive to use.
      
      Let's move the dict creation to .read(). This will make even more sense once we
      start adding readdelta() and other similar methods to manifestctx.
      be16091a
    • Durham Goode's avatar
      manifest: make one use of _mancache avoid manifestctxs · 1619efcd
      Durham Goode authored
      In a future patch we will change manifestctx and treemanifestctx to no longer
      derive from manifestdict and treemanifest, respectively. This means that
      consumers of the _mancache will now need to be aware of the different between
      the two, until we get rid of the manifest entirely and the _mancache becomes
      only filled with ctxs.
      
      This fixes one case of it that can be fixed by using the other cache. Future
      patches will address the others uses using the upcoming manifestctx.read()
      function.
      1619efcd
  19. Aug 21, 2016
  20. Sep 08, 2016
  21. Aug 21, 2016
    • Yuya Nishihara's avatar
      debugrevspec: evaluate tree built by itself · a82e138d
      Yuya Nishihara authored
      Prepares for new option to evaluate an unoptimized tree.
      
      Since a revset expression is no longer parsed twice, alias warnings should
      be displayed at the first parsing stages. That's why showwarning=ui.warn is
      added.
      a82e138d
  22. Sep 11, 2016
    • Katsunori FUJIWARA's avatar
      localrepo: make _refreshfilecachestats unfiltered method to refresh correctly · e35a83ce
      Katsunori FUJIWARA authored
      Before this patch, if transaction is started via "filtered repo"
      object, _refreshfilecachestats() at closing transaction doesn't
      refresh file stat of any @filecache properties correctly, because:
      
        - _refreshfilecachestats() omits refreshing file stat of a
          @filecache property, if it doesn't appear in self.__dict__
      
        - if transaction is started via "filtered repo",
          _refreshfilecachestats() is applied on "filtered repo"
      
          because repo.transaction() adds "self._refreshfilecachestats" to
          post close procedures. repo.transaction() isn't unfiltered method,
          and "self" in it means "filtered repo" in this case.
      
          Transactions started by explicit repo.transaction() easily causes
          this situation.
      
        - _refreshfilecachestats() applied on "filtered repo" omits whole
          refreshing
      
          because @filecache properties are stored into "unfiltered repo",
          and appear only in self.__dict__ of "unfiltered repo".
      
      This incorrect refreshing causes unnecessary reloading from files.
      
      To refresh file stat of @filecache properties at closing transaction
      correctly, this patch makes _refreshfilecachestats() unfiltered
      method.
      
      This patch chooses making _refreshfilecachestats() unfiltered method
      instead of making transaction() unfiltered method, to reduce
      unexpected side effect.
      e35a83ce
    • Katsunori FUJIWARA's avatar
      streamclone: clear caches after writing changes into files for visibility · 519a0226
      Katsunori FUJIWARA authored
      Before this patch, streamclone-ed changes are invisible via @filecache
      properties to in-process procedures before closing transaction
      (e.g. pretxnclose python hook), if corresponded property is cached
      before consumev1(). Strictly speaking, caching should occur inside
      (store) lock for transaction.
      
      repo.invalidate() after closing transaction is too late to force
      @filecache properties to be reloaded from changed files at next
      access.
      
      For visibility of streamclone-ed changes to in-process procedures
      before closing transaction, this patch clears caches just after
      writing changes into files.
      
      BTW, regardless of changing in this patch, clearing cached properties
      in consumev1() causes inconsistency, if (1) transaction is started and
      (2) any @filecache property is changed before consumev1().
      
      This patch also adds the comment to fix this (potential) inconsistency
      in the future.
      519a0226
    • Katsunori FUJIWARA's avatar
      localrepo: make invalidate avoid invalidating store inside transaction (API) · d9c49138
      Katsunori FUJIWARA authored
      Before this patch, invalidate() discards in-memory fncache changes,
      even inside transaction scope.
      
      Such changes should be written out at closing transaction. Otherwise,
      fncache might overlook newly added files. A file overlooked by
      fncache isn't accessible via store vfs, even if it actually exists in
      store.
      
      On the other hand, a non-existing file in fncache is less harmful,
      because fncachestore always examines whether a file actually exists or
      not before access. Therefore, discarding in-memory changes can be
      safely omitted.
      
      It is typical case that repo.invalidate() in streamclone is executed
      inside nested transaction.
      
      This patch makes invalidate() avoid invalidating store inside
      transaction.
      
      This patch focuses on describing only how invalidate() changes own
      behavior according to activity of transaction. Describing other detail
      of invalidate() in docstr will be done in another series, which
      refactors invalidate*() functions.
      d9c49138
    • Katsunori FUJIWARA's avatar
      streamclone: force @filecache properties to be reloaded from file · f32f8bf5
      Katsunori FUJIWARA authored
      Before this patch, consumev1() invokes repo.invalidate() after closing
      transaction, to force @filecache properties to be reloaded from files
      at next access, because streamclone writes data into files directly.
      
      But this doesn't work as expected in the case below:
      
        1. at closing transaction, repo._refreshfilecachestats() refreshes
           file stat of each @filecache properties with streamclone-ed files
      
           This means that in-memory properties are treated as valid.
      
        2. but streamclone doesn't changes in-memory properties
      
           This means that in-memory properties are actually invalid.
      
        3. repo.invalidate() just forces to examine file stat of @filecache
           properties at the first access after it
      
           Such examination should concludes that reloading from file isn't
           needed, because file stat was already refreshed at (1).
      
           Therefore, invalid in-memory cached properties (2) are
           unintentionally treated as valid (1).
      
      This patch invokes repo.invalidate() with clearfilecache=True, to
      force @filecache properties to be reloaded from file at next access.
      
      BTW, it is accidental that repo.invalidate() without
      clearfilecache=True in streamclone case seems to work as expected
      before this patch.
      
      If transaction is started via "filtered repo" object,
      repo._refreshfilecachestats() tries to refresh file stat of each
      @filecache properties on "filtered repo" object, even though all of
      them are stored into "unfiltered repo" object.
      
      In this case, repo._refreshfilecachestats() does nothing
      unintentionally, but this unexpected behavior causes reloading
      @filecache properties after repo.invalidate().
      
      This is reason why this patch should be applied before making
      _refreshfilecachestats() correctly refresh file stat of @filecache
      properties.
      f32f8bf5
Loading