Skip to content
Snippets Groups Projects
  1. May 07, 2015
    • Katsunori FUJIWARA's avatar
      rebase: use dirstateguard instead of dirstate.invalidate · c8a97fa7
      Katsunori FUJIWARA authored
      Before this patch, "rebase.concludenode()" uses "dirstate.invalidate()"
      as a kind of "restore .hg/dirstate to the original status" during a failure.
      
      But it just discards changes in memory, and doesn't actually restore
      ".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
      is executed while processing.
      
      This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
      restore ".hg/dirstate" during a failure even if "dirstate.write()" is
      executed before a failure.
      
      This patch also removes "beginparentchage()" and "endparentchange()",
      because "dirstateguard" makes them useless.
      
      This is a part of preparations to fix the issue that the recent (in
      memory) dirstate isn't visible to external processes (e.g. "precommit"
      hook).
      
      After this patch, the changed dirstate becomes visible to external
      "precommit" hooks during "hg rebase" in "test-largefiles-misc.t",
      because "dirstateguard()" writes it out. But this content isn't yet
      correct, because:
      
        - "normal3" should be marked as "A"(dded) at committing
      
          It is newly added in the changeset being rebased.
      
        - but it is marked as "M"(odified)
      
          The result of "repo.setparents()" after "dirstateguard()" isn't
          yet written out before "precommit". So, merging is still in
          progress for "hg status" in it.
      
          This causes marking the file newly added on "other" branch as "A".
      
      This will be fixed by subsequent patch.
      c8a97fa7
    • Katsunori FUJIWARA's avatar
      mq: use dirstateguard instead of dirstate.invalidate (qrefresh) · 12f3c714
      Katsunori FUJIWARA authored
      Before this patch, "mq.queue.refresh()" uses "dirstate.invalidate()"
      as a kind of "restore .hg/dirstate to the original status" during a failure.
      
      But it just discards changes in memory, and doesn't actually restore
      ".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
      is executed while processing.
      
      This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
      restore ".hg/dirstate" during a failure even if "dirstate.write()" is
      executed before a failure.
      
      This patch also removes "beginparentchage()" and "endparentchange()",
      because "dirstateguard" makes them useless.
      
      This is a part of preparations to fix the issue that the recent (in
      memory) dirstate isn't visible to external processes (e.g. "precommit"
      hook).
      12f3c714
    • Katsunori FUJIWARA's avatar
      mq: use dirstateguard instead of dirstate.invalidate (qpush) · 58308dde
      Katsunori FUJIWARA authored
      Before this patch, "mq.queue.apply()" uses "dirstate.invalidate()" as
      a kind of "restore .hg/dirstate to the original status" during afailure.
      
      But it just discards changes in memory, and doesn't actually restore
      ".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
      is executed while processing.
      
      This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
      restore ".hg/dirstate" at failure even if "dirstate.write()" is
      executed before failure.
      
      This is a part of preparations to fix the issue that the recent (in
      memory) dirstate isn't visible to external processes (e.g. "precommit"
      hook).
      58308dde
    • Katsunori FUJIWARA's avatar
      tryimportone: use dirstateguard instead of beginparentchange/endparentchange · 0579b0c2
      Katsunori FUJIWARA authored
      To fix the issue that the recent (in memory) dirstate isn't visible to
      external process (e.g. "precommit" hook), a subsequent patch makes
      "localrepository.commit()" invoke "dirstate.write()" in it.
      
      This change will make "beginparentchange()" and "endparentchange()" on
      dirstate in "cmdutil.tryimportone()" meaningless, because:
      
        - "dirstate.write()" writes changed data into ".hg/dirstate", but
      
        - aborting between "beginparentchange()" and "endparentchange()"
          doesn't cause any restoring ".hg/dirstate"
      
          it just discards changes in memory.
      
      This patch uses "dirstateguard" instead of "beginparentchange()" and
      "endparentchange()" in "cmdutil.tryimportone()" to restore
      ".hg/dirstate" during a failure even if "dirstate.write()" is executed
      before a failure.
      
      This patch uses "lockmod.release(dsguard)" instead of
      "dsguard.release()", because processing may be aborted before
      assignment to "dsguard" , and the "if dsguard" examination for safety is
      redundant.
      0579b0c2
    • Katsunori FUJIWARA's avatar
      import: use dirstateguard instead of dirstate.invalidate · 713b09fc
      Katsunori FUJIWARA authored
      Before this patch, "commands.import()" uses "dirstate.invalidate()" as
      a kind of "restore .hg/dirstate to the original status" during a failure.
      
      But it just discards changes in memory, and doesn't actually restore
      ".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
      is executed while processing.
      
      This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
      restore ".hg/dirstate" at failure even if "dirstate.write()" is
      executed before failure.
      
      This patch also removes "beginparentchage()" and "endparentchange()",
      because "dirstateguard" makes them useless, too.
      
      This is a part of preparations to fix the issue that the recent (in
      memory) dirstate isn't visible to external process (e.g. "precommit"
      hook).
      713b09fc
    • Katsunori FUJIWARA's avatar
      amend: use dirstateguard instead of dirstate.invalidate · be58bd30
      Katsunori FUJIWARA authored
      Before this patch, "cmdutil.amend()" uses "dirstate.invalidate()" as a
      kind of "restore .hg/dirstate to the original status" during a failure.
      
      But it just discards changes in memory, and doesn't actually restore
      ".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
      is executed while processing.
      
      This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
      restore ".hg/dirstate" at failure even if "dirstate.write()" is
      executed before failure.
      
      This is a part of preparations to fix the issue that the recent (in
      memory) dirstate isn't visible to external process (e.g. "precommit"
      hook).
      be58bd30
    • Katsunori FUJIWARA's avatar
      localrepo: use changelog.hasnode instead of self.__contains__ · 7df090c9
      Katsunori FUJIWARA authored
      Before this patch, releasing the store lock implies the actions below, when
      the transaction is aborted:
      
        1. "commithook()" scheduled in "localrepository.commit()" is invoked
        2. "changectx.__init__()" is invoked via "self.__contains__()"
        3. specified ID is examined against "repo.dirstate.p1()"
        4. validation function is invoked in "dirstate.p1()"
      
      In subsequent patches, "dirstate.invalidate()" invocations for
      discarding changes are replaced with "dirstateguard", but discarding
      changes by "dirstateguard" is executed after releasing the store lock:
      resources are acquired in "wlock => dirstateguard => store lock" order,
      and are released in reverse order.
      
      This may cause that "dirstate.p1()" still refers to the changeset to be
      rolled-back at (4) above: pushing multiple patches by "hg qpush" is
      a typical case.
      
      When releasing the store lock, such changesets are:
      
        - not contained in "repo.changelog", if it is reloaded from
          ".hg/00changelog.i", as that file was already truncated by
          "transaction.abort()"
      
        - still contained in it, otherwise
          (this "dirty read" problem is discussed in "Transaction Plan"
           http://mercurial.selenic.com/wiki/TransactionPlan)
      
      Validation function shows "unknown working parent" warning in the
      former case, but reloading "repo.changelog" depends on the timestamp
      of ".hg/00changelog.i". This causes occasional test failures.
      
      In the case of scheduled "commithook()", it just wants to examine
      whether "node ID" of committed changeset is still valid or not. Other
      examinations implied in "changectx.__init__()" are meaningless.
      
      To avoid showing the "unknown working parent" warning irregularly, this
      patch uses "changelog.hasnode()" instead of "node in self" to examine
      existence of committed changeset.
      7df090c9
    • Katsunori FUJIWARA's avatar
      cmdutil: add class to restore dirstate during unexpected failure · 4169a4f8
      Katsunori FUJIWARA authored
      Before this patch, after "dirstate.write()" execution, there was no way to
      restore dirstate to the original status before "dirstate.write()".
      
      In some code paths, "dirstate.invalidate()" is used as a kind of "restore
      .hg/dirstate to the original status", but it just avoids writing changes in
      memory out, and doesn't actually restore the ".hg/dirstate" file.
      
      To fix the issue that the recent (in memory) dirstate isn't visible to external
      processes (e.g. "precommit" hooks), "dirstate.write()" should be invoked before
      invocation of external processes. But at the same time, ".hg/dirstate" should be
      restored to its content before "dirstate.write()" during an unexpected failure
      in some cases.
      
      This patch adds the class "dirstateguard" to easily restore ".hg/dirstate"
      during unexpected failures. Typical usecase of it is:
      
          # (1) build dirstate up
          ....
      
          # (2) write dirstate out, and backup ".hg/dirstate"
          dsguard = dirstateguard(repo, 'scopename')
          try:
              # (3) execute somethig to do:
              #     this may imply making some additional changes on dirstate
              ....
      
              # (4) unlink backed-up dirstate file at the end of dsguard scope
              dsguard.close()
          finally:
              # (5) if execution is aborted before "dsguard.close()",
              #     ".hg/dirstate" is restored from the backup
              dsguard.release()
      
      For this kind of issue, an "extending transaction" approach (in
      https://titanpad.com/mercurial32-sprint) seems to not be suitable, because:
      
        - transaction nesting occurs in some cases (e.g. "shelve => rebase"), and
      
        - "dirstate" may be already modified since the beginning of OUTER
          transaction scope, then
      
        - dirstate should be backed up into the file other than
          "dirstate.journal" at the beginning of INNER transaction scope, but
      
        - such alternative backup files are useless for transaction itself,
          and increases complication of its implementation
      
      "transaction" and "dirstateguard" differ from each other also in "what
      it should do for .hg/dirstate" in cases other than success.
      
        ============== ======= ======== =============
        type           success fail     "hg rollback"
        ============== ======= ======== =============
        transaction    keep     keep     restore
        dirstateguard  keep     restore  (not implied)
        ============== ======= ======== =============
      
      Some collaboration between transaction and dirstate will probably be introduced
      in the future. But this layer is needed in all cases.
      4169a4f8
  2. May 10, 2015
  3. May 09, 2015
  4. May 04, 2015
  5. Apr 14, 2015
    • Ryan McElroy's avatar
      bookmarks: simplify iscurrent to isactivewdirparent (API) · fb9b7b93
      Ryan McElroy authored
      Previously this function accepted two optional parameters that were unused by
      any callers and complicated the function.
      
      Today, the terms 'active' and 'current' are interchangeably used throughout the
      codebase in reference to the active bookmark (the bookmark that will be updated
      with the next commit). This leads to confusion among developers and users.
      This patch is part of a series to standardize the usage to 'active' throughout
      the mercurial codebase and user interface.
      fb9b7b93
  6. May 05, 2015
  7. May 08, 2015
  8. May 09, 2015
  9. Apr 30, 2015
  10. Apr 29, 2015
  11. Apr 12, 2015
  12. May 06, 2015
  13. May 07, 2015
  14. May 06, 2015
    • Augie Fackler's avatar
      builddeb: new script for building a deb package · ab75baaf
      Augie Fackler authored
      Future work will allow us to use docker to build debs.
      
      Right now this doesn't install any config files. I plan to do that as
      a followup, but getting something basic and working checked in seems
      like more of a priority than getting everything done in one big step.
      
      This also does not create a source deb yet. I haven't looked into that
      process.
      
      Note that this declares incompatibility with the `mercurial-common`
      package. It's typical for debian packages to be split between
      architecture-independent bits and native bits, meaning the python bits
      downstream live in mercurial-common and the c extension bits live in
      mercurial. We don't do that because we want to (ideally) give users a
      single deb file to install.
      ab75baaf
    • Augie Fackler's avatar
      dockerlib: fix initcontainer for boot2docker users · 33055069
      Augie Fackler authored
      This allows me to build rpm packages using boot2docker on my Mac. It's
      probably a very fragile hack, but it seems to work well enough for now
      that I felt it was worth sharing.
      33055069
    • Augie Fackler's avatar
      dockerlib: extract initcontainer() method · 227b9b2a
      Augie Fackler authored
      This helps contain all the logic around creating containers.
      227b9b2a
    • Augie Fackler's avatar
      dockerlib: start extracting common functions for setting up docker · 80c9e99d
      Augie Fackler authored
      I'm about to start interacting with docker for Debian packaging too,
      so it's time to centralize this so that any bugfixes I figure out
      apply to both codepaths.
      80c9e99d
  15. May 08, 2015
    • Pierre-Yves David's avatar
      run-test: ensure the test ports are available before launching test · 00790cc2
      Pierre-Yves David authored
      I'm running into a systematic issue because there is always some port taken in the
      1500-wide range of ports used by the test (3 for each test file).
      00790cc2
    • Yuya Nishihara's avatar
      templater: strip single backslash before quotation mark in quoted template · 554d6fcc
      Yuya Nishihara authored
      db7463aa080f fixed the issue of double escapes, but it made the following
      template fail with syntax error because of <\">. Strictly speaking, <\">
      appears to be invalid in non-string part, but we are likely to escape <">
      if surrounded by quotes, and we are used to write such templates by trial
      and error.
      
        [templates]
        sl = "{tags % \"{ifeq(tag,'tip','',label('log.tag', ' {tag}'))}\"}"
      
      So, for backward compatibility between 2.8.1 and 3.4, a single backslash
      before quotation mark is stripped only in quoted template. We don't care
      for <\"> in string literal in quoted template, which never worked as expected
      before.
      
        template  result
        --------- ------------------------
        {\"\"}    parse error
        "{""}"    {""} -> <>
        "{\"\"}"  {""} -> <>
        {"\""}    {"\""} -> <">
        '{"\""}'  {"\""} -> <">
        "{"\""}"  parse error (don't care)
      554d6fcc
    • Pierre-Yves David's avatar
      run-tests: implement Test._testMethodName · cecbe207
      Pierre-Yves David authored
      This methods is needed internally by utilities like __repr__. I do not see any
      harm in having it declared. Any actual attempt to use it to call a test would
      crash, but at least random debug print in the test runner will no longer crash.
      
      Another approach would have been to redefine the __repr__ function, but I think
      it a good thing to have some respect for the base class API.
      cecbe207
  16. May 07, 2015
  17. Apr 14, 2015
  18. May 10, 2015
  19. May 08, 2015
  20. May 01, 2015
    • Durham Goode's avatar
      histedit: fix --continue when rules are finished · 3c762cce
      Durham Goode authored
      If histedit failed after all the rules were complete (for instance, if there was
      an exception in the cleanup phase), you couldn't --continue because it was
      unable to pop a rule. Let's just skip the rule execution phase of --continue if
      there are no more rules.
      3c762cce
Loading