Skip to content
Snippets Groups Projects
  1. Jun 16, 2015
    • Anton Shestakov's avatar
      hgweb: don't dereference symbolic revision in paper & coal style (issue2296) · 3bb6f5f4
      Anton Shestakov authored
      Let's make paper (and coal, since it borrows so much from paper) templates use
      symbolic revision in navigation links.
      
      The majority of links (log, filelog, annotate, etc) still use node hashes.
      
      Some pages don't have permanent links to current node hash (so it's not very
      easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
      patches.
      3bb6f5f4
    • Anton Shestakov's avatar
      hgweb: don't dereference symbolic revision in gitweb style · dd893046
      Anton Shestakov authored
      Let's make gitweb templates use symbolic revision in navigation links.
      
      The majority of links (log, filelog, annotate, etc) still use node hashes.
      
      Some pages don't have permanent links to current node hash (so it's not very
      easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
      patches.
      dd893046
    • Anton Shestakov's avatar
      hgweb: don't dereference symbolic revision in monoblue style · 0cdcbc47
      Anton Shestakov authored
      Let's make monoblue templates use symbolic revision in navigation links.
      
      The majority of links (log, filelog, annotate, etc) still use node hashes.
      
      Some pages don't have permanent links to current node hash (so it's not very
      easy to go from /rev/tip to /rev/<tip hash>), this will be addressed in future
      patches.
      0cdcbc47
    • Anton Shestakov's avatar
      hgweb: don't dereference symbolic revision in spartan style · 1cac419a
      Anton Shestakov authored
      Let's make spartan templates use symbolic revision in navigation links.
      
      The majority of links (log, filelog, annotate, etc) still use node hashes, and
      many pages also have permanent link to current node hash (i.e. you can go from
      /rev/tip to /rev/<tip hash> without manual url editing), so it's safe to
      update navigation.
      1cac419a
  2. Jun 15, 2015
    • Anton Shestakov's avatar
      hgweb: provide symrev (symbolic revision) property to the templates · 85fb416f
      Anton Shestakov authored
      One of the features of hgweb is that current position in repo history is
      remembered between separate requests. That is, links from /rev/<node_hash> lead
      to /file/<node_hash> or /log/<node_hash>, so it's easy to dig deep into the
      history. However, such links could only use node hashes and local revision
      numbers, so while staying at one exact revision is easy, staying on top of the
      changes is not, because hashes presumably can't change (local revision numbers
      can, but probably not in a way you'd find useful for navigating).
      
      So while you could use 'tip' or 'default' in a url, links on that page would be
      permanent. This is not always desired (think /rev/tip or /graph/stable or
      /log/@) and is sometimes just confusing (i.e. /log/<not the tip hash>, when
      recent history is not displayed). And if user changed url deliberately to say
      default instead of <some node hash>, the page ignores that fact and uses node
      hash in its links, which means that navigation is, in a way, broken.
      
      This new property, symrev, is used for storing current revision the way it was
      specified, so then templates can use it in links and thus "not dereference" the
      symbolic revision. It is an additional way to produce links, so not every link
      needs to drop {node|short} in favor of {symrev}, many will still use node hash
      (log and filelog entries, annotate lines, etc).
      
      Some pages (e.g. summary, tags) always use the tip changeset for their context,
      in such cases symrev is set to 'tip'. This is needed in case the pages want to
      provide archive links.
      
      highlight extension needs to be updated, since _filerevision now takes an
      additional positional argument (signature "web, req, tmpl" is used by most of
      webcommands.py functions).
      
      More references to symbolic revisions and related gripes: issue2296, issue2826,
      issue3594, issue3634.
      85fb416f
  3. Jun 17, 2015
    • Matt Harbison's avatar
      archive: support 'wdir()' · 3ec8351f
      Matt Harbison authored
      This is a step toward replacing the extdiff internals with archive, in order to
      support 'extdiff -S'.  Only Mercurial subrepos are supported for now.
      
      If a file is missing from the filesystem, it is silently skipped.  Perhaps it
      should warn, but it cannot abort when working with extdiff because deleting a
      file is a legitimate diff.
      3ec8351f
    • Matt Harbison's avatar
      subrepo: allow a representation of the working directory subrepo · 70ac1868
      Matt Harbison authored
      Some code cannot handle a subrepo based on the working directory (e.g.
      sub.dirty()), so the caller must opt in.  This will be useful for archive, and
      perhaps some other commands.  The git and svn methods where this is used may
      need to be fixed up on a case by case basis.
      70ac1868
  4. Jun 16, 2015
    • Yuya Nishihara's avatar
      templater: comment that gettemplate() has different name resolution order · 695b93a7
      Yuya Nishihara authored
      I've tried to unify gettemplate() with buildtemplate(), but it didn't go well
      because gettemplate() have to bypass mapping dict.
      
      For example, web templates have '{tags%changelogtag}' and 'changelogtag' is
      defined in both mapping, the default, and context.cache, sourced from map file.
      In general, mapping shadows context variables, but gettemplate() have to pick
      it from context.cache.
      695b93a7
  5. Jun 13, 2015
  6. Jun 10, 2015
  7. Jun 13, 2015
    • Yuya Nishihara's avatar
      templater: take any string literals as template, but not for rawstring (BC) · c1975809
      Yuya Nishihara authored
      This patch series is intended to unify the interpretation of string literals.
      It is breaking change that boldly assumes
      
       a. string literal "..." never contains template-like fragment or it is
          intended to be a template
       b. we tend to use raw string literal r"..." for regexp pattern in which "{"
          should have different meaning
      
      Currently, we don't have a comprehensible rule how string literals are
      evaluated in template functions. For example, fill() takes "initialindent"
      and "hangindent" as templates, but not for "text", whereas "text" is a
      template in pad() function.
      
        date(date, fmt)
        diff(includepattern, excludepattern)
        fill(text, width, initialident: T, hangindent: T)
        get(dict, key)
        if(expr, then: T, else: T)
        ifcontains(search, thing, then: T, else: T)
        ifeq(expr1, expr2, then: T, else: T)
        indent(text, indentchars, firstline)
        join(list, sep)
        label(label: T, expr: T)
        pad(text: T, width, fillchar, right)
        revset(query, formatargs...])
        rstdoc(text, style)
        shortest(node, minlength)
        startswith(pattern, text)
        strip(text, chars)
        sub(pattern, replacement, expression: T)
        word(number, text, separator)
        expr % template: T
      
        T: interpret "string" or r"rawstring" as template
      
      This patch series adjusts the rule as follows:
      
       a. string literal, '' or "", starts template processing (BC)
       b. raw string literal, r'' or r"", disables both \-escape and template
          processing (BC, done by subsequent patches)
       c. fragment not surrounded by {} is non-templated string
      
        "ccc{'aaa'}{r'bbb'}"
         ------------------  *: template
         ---                 c: string
              ---            a: template
                      ---    b: rawstring
      
      Because this can eliminate the compilation of template arguments from the
      evaluation phase, "hg log -Tdefault" gets faster.
      
        % cd mozilla-central
        % LANG=C HGRCPATH=/dev/null hg log -Tdefault -r0:10000 --time > /dev/null
        before: real 4.870 secs (user 4.860+0.000 sys 0.010+0.000)
        after:  real 3.480 secs (user 3.440+0.000 sys 0.030+0.000)
      
      Also, this will allow us to parse nested templates at once for better error
      indication.
      c1975809
  8. Jun 12, 2015
  9. Jun 15, 2015
  10. Jun 16, 2015
    • Matt Harbison's avatar
      verify: check the subrepository references in .hgsubstate · f1d46075
      Matt Harbison authored
      While hopefully atypical, there are reasons that a subrepository revision can be
      lost that aren't covered by corruption of the .hgsubstate revlog.  Such things
      can happen when a subrepo is amended, stripped or simply isn't pulled from
      upstream because the parent repo revision wasn't updated yet.  There's no way to
      know if it is an error, but this will find potential problems sooner than when
      some random revision is updated.
      
      Until recently, convert made no attempt at rewriting the .hgsubstate file.  The
      impetuous for this is to verify the conversion of some repositories, and this is
      orders of magnitude faster than a bash script from 0..tip that does an
      'hg update -C $rev'.  But it is equally useful to determine if everything has
      been pulled down before taking a thumb drive on the go.
      
      It feels somewhat wrong to leave this out of verifymod (mostly because the file
      is already read in there, and the final summary is printed before the subrepos
      are checked).  But verifymod looks very low level, so importing subrepo stuff
      there seems more wrong.
      f1d46075
  11. Jun 15, 2015
    • Matt Harbison's avatar
      context: override workingctx.hex() to avoid a crash · 183965a0
      Matt Harbison authored
      Since node is None for workingctx, it can't use the base class
      implementation of 'hex(self.node())'.
      
      It doesn't appear that there are any current callers of this, but there will be
      when archive supports 'wdir()'.  My first thought was to use "{p1node}+", but
      that would cause headaches elsewhere [1].
      
      We should probably fix up localrepository.__getitem__ to accept this hash for
      consistency, as a followup.  This works, if the full hash is specified:
      
        @@ -480,7 +480,7 @@
                 return dirstate.dirstate(self.vfs, self.ui, self.root, validate)
      
             def __getitem__(self, changeid):
        -        if changeid is None:
        +        if changeid is None or changeid == 'ff' * 20:
                     return context.workingctx(self)
                 if isinstance(changeid, slice):
                     return [context.changectx(self, i)
      
      That differs from null, where it will accept any number of 0s, as long as it
      isn't ambiguous.
      
      
      [1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071166.html
      183965a0
    • Matt Harbison's avatar
  12. Jun 16, 2015
  13. Jun 03, 2015
    • Anton Shestakov's avatar
      tests: test symbolic revision (de)reference in all hgweb styles · e7455316
      Anton Shestakov authored
      Right now the way revisions get specified in hgweb urls is ignored, i.e. after
      revision is resolved, only its node hash (or sometimes local revision number)
      is used for all links in the templates. So, basically, every page for "tip"
      revision (or any other symbolic rev id) will dereference it: lose the nice
      symbolic name by putting node hash/local rev number in its place. The only
      exception so far is archive links on some pages: /archive/tip.{bz2,gz,zip}.
      
      The fact that this dereferencing is neither convenient nor intuitive is
      reflected in issue2296, issue2826 and issue3594. issue3634 also mentions this.
      But to fix this it's first needed to demonstrate and test the way templates
      currently form links.
      
      The new test file is separate from other hgweb tests, since it seems big and
      distinct enough. And it's so big because links are formed in each template
      independently, so it's necessary to test them all to avoid any inconsistent
      behavior.
      e7455316
  14. Jun 16, 2015
  15. Jun 15, 2015
  16. May 27, 2015
    • Martin von Zweigbergk's avatar
      match: don't remove '.' from _includeroots · b76410ee
      Martin von Zweigbergk authored
      This makes _includeroots more like _fileroots and gives visitdir() a
      nice symmetry in the two.
      
      I'm hoping to later combine the two (_fileroots and _includeroots),
      and having them treated similarly should make that step easier to
      follow.
      b76410ee
  17. May 31, 2015
  18. May 27, 2015
  19. Jun 12, 2015
  20. Jun 15, 2015
    • Matt Harbison's avatar
      subrepo: introduce hgsubrepo._getctx() · 3d8c044e
      Matt Harbison authored
      This code is already used in a couple of places, and will need to be used in
      others where wdir() support is needed.  Trying to get the wdir() revision stored
      in self._substate[1] when creating the object in subrepo.subrepo() resulted in
      breaking various status and diff tests.  This is a far less invasive change.
      3d8c044e
  21. Jun 14, 2015
    • Matt Harbison's avatar
      convert: apply the appropriate phases to the destination (issue4165) · 1abfe639
      Matt Harbison authored
      If the conversion doesn't change the hash, and the cset is public in the source,
      it should be public in the destination.  (This can happen if file remapping is
      done that doesn't affect the initial commits.)  This also propagates the secret
      phase from the source, regardless of the hash, because presumably the content is
      what is secret.  Otherwise, the destination commit stays in the draft phase.
      
      Maybe any draft cset with an unchanged hash should be changed to public, because
      it has effectively been shared, but convert pretty strongly implies throwing
      away (or at least readonly archiving) the source repo.
      
      The change in the rollback output is because the name of the outer transaction
      is now 'convert', which seems more accurate.  Unfortunately, the memctx won't
      indicate the hash prior to committing, so the proper phase can't be applied with
      the commit.
      
      The repo is already write locked in mercurial_sink.before().
      1abfe639
    • Matt Harbison's avatar
      convert: always track the hg source revision in the internal commit object · 7cc1d33f
      Matt Harbison authored
      This will be needed in the next patch to determine if phases need to be
      adjusted.  The insertion of the source revision in 'extras{}' is still
      controlled by the config property.
      7cc1d33f
  22. Jun 13, 2015
    • Laurent Charignon's avatar
      repoview: invalidate 'visible' filtered revisions when bookmarks change · 2612e6da
      Laurent Charignon authored
      Context: the result of computehidden, used to compute the 'visible' revisions
      is cached. Its output can change when:
      1) new obsolete commits are created
      2) new bookmarks are created or deleted
      3) new tags are created or deleted
      4) the parents of the working copy change
      
      We currently correctly invalidate the cache only in the case 1).
      This patch fixes the second case (bookmarks) by invalidating the cache once
      a bookmark is added or removed.
      2612e6da
    • Matt Harbison's avatar
      ui: flush stderr after printing a non-chained exception for Windows · c1ff82da
      Matt Harbison authored
      There were consistent test failures in test-bad-extension.t, because Windows
      buffers stderr when redirected to a file (per the comment in ui.write_err()).
      That resulted in failures like this:
      
        --- c:/Users/Matt/Projects/hg/tests/test-bad-extension.t
        +++ c:/Users/Matt/Projects/hg/tests/test-bad-extension.t.err
        @@ -23,11 +23,11 @@
           Traceback (most recent call last):
           Exception: bit bucket overflow
           *** failed to import extension badext2: No module named badext2
        -  Traceback (most recent call last):
        -  ImportError: No module named badext2
           hg help [-ec] [TOPIC]
      
           show help for a given topic or a help overview
        +  Traceback (most recent call last):
        +  ImportError: No module named badext2
      
         show traceback for ImportError of hgext.name if debug is set
         (note that --debug option isn't applied yet when loading extensions)
      
      Instead of inserting another flush immediately after the print, to go along with
      the one recently added prior to the print (see 3ff4b07412ad), funnel the output
      through ui.write_err().  The flush prior to printing the traceback only mentions
      that stdout needs to be flushed, and only stderr needs to be flushed after
      printing the traceback.  ui.write_err() does both for us without needing to
      redocument the quirky Windows behavior.  It will also clear any progress bar.
      c1ff82da
  23. Jun 12, 2015
    • Pierre-Yves David's avatar
      revset: use parentsets.min in _children · f140d620
      Pierre-Yves David authored
      As stated in the comment, using the smartset 'min' will give more opportunity to
      be smart. It give a small but significant boost to the performance. Most of the
      time is still spend doing the actual computation but at least we can scrap some
      performance when it makes sense.
      
      revset #0: roots(0:tip)
         plain
      0) 0.046600
      1) 0.044109  94%
      f140d620
Loading