1. 06 4月, 2013 1 次提交
  2. 29 3月, 2013 5 次提交
    • T
      Speed up log -L... -M · 39410bf0
      Thomas Rast 提交于
      So far log -L only used the implicit diff filtering by pathspec.  If
      the user specifies -M, we cannot do that, and so we simply handed the
      whole diff queue (which is approximately 'git show --raw') to
      diffcore_std().
      
      Unfortunately this is very slow.  We can optimize a lot if we throw
      out files that we know cannot possibly be interesting, in the same
      spirit that the pathspec filtering reduces the number of files.
      
      However, in this case, we have to be more careful.  Because we want to
      look out for renames, we need to keep all filepairs where something
      was deleted.
      
      This is a bit hacky and should really be replaced by equivalent
      support in --follow, and just using that.  However, in the meantime it
      speeds up 'log -M -L' by an order of magnitude.
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      39410bf0
    • T
      log -L: :pattern:file syntax to find by funcname · 13b8f68c
      Thomas Rast 提交于
      This new syntax finds a funcname matching /pattern/, and then takes from there
      up to (but not including) the next funcname.  So you can say
      
        git log -L:main:main.c
      
      and it will dig up the main() function and show its line-log, provided
      there are no other funcnames matching 'main'.
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      13b8f68c
    • T
      Implement line-history search (git log -L) · 12da1d1f
      Thomas Rast 提交于
      This is a rewrite of much of Bo's work, mainly in an effort to split
      it into smaller, easier to understand routines.
      
      The algorithm is built around the struct range_set, which encodes a
      series of line ranges as intervals [a,b).  This is used in two
      contexts:
      
      * A set of lines we are tracking (which will change as we dig through
        history).
      * To encode diffs, as pairs of ranges.
      
      The main routine is range_set_map_across_diff().  It processes the
      diff between a commit C and some parent P.  It determines which diff
      hunks are relevant to the ranges tracked in C, and computes the new
      ranges for P.
      
      The algorithm is then simply to process history in topological order
      from newest to oldest, computing ranges and (partial) diffs.  At
      branch points, we need to merge the ranges we are watching.  We will
      find that many commits do not affect the chosen ranges, and mark them
      TREESAME (in addition to those already filtered by pathspec limiting).
      Another pass of history simplification then gets rid of such commits.
      
      This is wired as an extra filtering pass in the log machinery.  This
      currently only reduces code duplication, but should allow for other
      simplifications and options to be used.
      
      Finally, we hook a diff printer into the output chain.  Ideally we
      would wire directly into the diff logic, to optionally use features
      like word diff.  However, that will require some major reworking of
      the diff chain, so we completely replace the output with our own diff
      for now.
      
      As this was a GSoC project, and has quite some history by now, many
      people have helped.  In no particular order, thanks go to
      
        Jakub Narebski <jnareb@gmail.com>
        Jens Lehmann <Jens.Lehmann@web.de>
        Jonathan Nieder <jrnieder@gmail.com>
        Junio C Hamano <gitster@pobox.com>
        Ramsay Jones <ramsay@ramsay1.demon.co.uk>
        Will Palmer <wmpalmer@gmail.com>
      
      Apologies to everyone I forgot.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      12da1d1f
    • B
      Export rewrite_parents() for 'log -L' · c7edcae0
      Bo Yang 提交于
      The function rewrite_one is used to rewrite a single
      parent of the current commit, and is used by rewrite_parents
      to rewrite all the parents.
      
      Decouple the dependence between them by making rewrite_one
      a callback function that is passed to rewrite_parents. Then
      export rewrite_parents for reuse by the line history browser.
      
      We will use this function in line-log.c.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c7edcae0
    • B
      Refactor parse_loc · 25ed3412
      Bo Yang 提交于
      We want to use the same style of -L n,m argument for 'git log -L' as
      for git-blame.  Refactor the argument parsing of the range arguments
      from builtin/blame.c to the (new) file that will hold the 'git log -L'
      logic.
      
      To accommodate different data structures in blame and log -L, the file
      contents are abstracted away; parse_range_arg takes a callback that it
      uses to get the contents of a line of the (notional) file.
      
      The new test is for a case that made me pause during debugging: the
      'blame -L with invalid end' test was the only one that noticed an
      outright failure to parse the end *at all*.  So make a more explicit
      test for that.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      25ed3412
  3. 28 2月, 2013 6 次提交
  4. 27 2月, 2013 5 次提交
  5. 26 2月, 2013 23 次提交