#5037 View revisions for a file/dir

v1.0.0
closed
nobody
SCM
Cory Johns
2015-08-20
2012-10-02
No

Currently all the 'History' links in the SCM browse go to a URL like https://sourceforge.net/p/allura/git/ci/0298d85091dd970b0c6d57c914e43643b604a6a8/log/ which shows the revisions starting at the given commit. There should be a way to view revisions limited to a specified directory or file. E.g. URL might be something like https://sourceforge.net/p/allura/git/ci/0298d85091dd970b0c6d57c914e43643b604a6a8/log/ForgeBlog/forgeblog/tests/ This needs to be implemented for Git, Hg, and SVN.

Then, change the History links so that when you're browsing a tree or file, the link goes to the /log/ URL containing the file/folder path.

Related

Tickets: #4929
Tickets: #5037

Discussion

  • Igor Bondarenko - 2012-10-03

    Created #184: [#5037] View revisions for a file/dir (2cp)

    • status: open --> in-progress
     

    Related

    Tickets: #5037

  • Igor Bondarenko - 2012-10-10

    Closed #182. Branch 42cc_5037.

    • status: in-progress --> code-review
     
  • Chris Tsai - 2012-10-17
    • labels: 42cc --> 42cc, p2
     
  • Dave Brondsema

    Dave Brondsema - 2012-10-30
    • qa: Cory Johns
     
  • Cory Johns - 2012-11-01

    Building the entire list of commits for a path before applying paging could get us into trouble with large repos (we do have some where such things have been an issue in the past).

    All three implementation support passing in the start rev, and Git and SVN both explicitly support a limit, while Mercurial uses generators so counting the limit manually would be fine. The start offset is a little more tricky but could still be done more efficiently inside the implementation instead of at the controller level.

    Also, the Mercurial implementation appears to have been pulled from a library or something, as there is a fair amount of unused options and code (all of getrenamed and prep could be removed). Please clean that up.

    Finally, this has gotten out of date with the current master and there are some small merge conflicts, if you could resolve those as well.

     
  • Cory Johns - 2012-11-01
    • status: code-review --> open
     
  • Dave Brondsema

    Dave Brondsema - 2012-11-01

    If we are re-using code from elsewhere, we need to track the license and original location of that.

     
  • Igor Bondarenko - 2012-11-02
    • status: open --> in-progress
     
  • Igor Bondarenko - 2012-11-02

    Created #202: [#5037] View revisions for a file/dir optimization (2cp)

     

    Related

    Tickets: #5037

  • Igor Bondarenko - 2012-11-08

    Closed #202. Branch 42cc_5037a.

     
  • Igor Bondarenko - 2012-11-08
    • status: in-progress --> code-review
     
  • Igor Bondarenko - 2012-11-08

    We've resolved merge conflicts with master and changed code to handle limiting commits inside the SCM implementation where it is possible.

    Also Mercurial implementation was cleaned up (for inspiration we've looked on the mercurials code itself, third-party libraries were not involved)

     
  • Cory Johns - 2012-11-09
    • status: code-review --> open
     
  • Cory Johns - 2012-11-09

    Got the following error when trying to view history of a file or path in Hg:

    File '/home/cjohns/cjohns-7019/forge/Allura/allura/controllers/repository.py', line 434 in log
      commits = c.app.repo.commits(skip=start, limit=limit, **params)
    File '/home/cjohns/cjohns-7019/forge/Allura/allura/model/repository.py', line 226 in commits
      return self._impl.commits(path, rev, skip, limit)
    File '/home/cjohns/cjohns-7019/forge/ForgeHg/forgehg/model/hg.py', line 302 in commits
      m = cmdutil.match(self._hg, [path])
    File '/var/local/env-allura/lib/python2.7/site-packages/mercurial-1.4.3-py2.7-linux-x86_64.egg/mercurial/cmdutil.py', line 264 in match
      opts.get('include'), opts.get('exclude'), default)
    File '/var/local/env-allura/lib/python2.7/site-packages/mercurial-1.4.3-py2.7-linux-x86_64.egg/mercurial/match.py', line 48 in __init__
      pats = _normalize(patterns, default, root, cwd)
    File '/var/local/env-allura/lib/python2.7/site-packages/mercurial-1.4.3-py2.7-linux-x86_64.egg/mercurial/match.py', line 223 in _normalize
      name = util.canonpath(root, cwd, name)
    File '/var/local/env-allura/lib/python2.7/site-packages/mercurial-1.4.3-py2.7-linux-x86_64.egg/mercurial/util.py', line 312 in canonpath
      raise Abort('%s not under root' % myname)
    Abort: /hg/p/t5037/mercurial/foo not under root
    

    It appears to have to do with using full paths:

    [root@h7v7019 env-allura mercurial]# pwd
    /hg/p/t5037/mercurial
    [root@h7v7019 env-allura mercurial]# hg log foo
    changeset:   100:1e872a03b1b9
    tag:         tip
    user:        Cory <...>
    date:        Fri Nov 09 18:18:45 2012 +0000
    summary:     commit-101
    
    [root@h7v7019 env-allura mercurial]# hg log /hg/p/53037/mercurial/foo
    abort: /hg/p/53037/mercurial/foo not under root
    
     
  • Igor Bondarenko - 2012-11-12

    Created #209: [#5037] Full path in hg commits raises exception (1cp)

     

    Related

    Tickets: #5037

  • Igor Bondarenko - 2012-11-12
    • status: open --> in-progress
     
  • Igor Bondarenko - 2012-11-13

    I see two possibilities here:

    • We can just cut all slashes at the beginning of the path and assume that resulting path is relative to the repo root. (thus even if path doesn't exist inside the repo, we'll get page with no commits, instead of 500 error)

    • Or we can detect full path that starts with repo root and handle it properly.

    However, I doubt that we need a second option. It seems to me that all links to history that I can reach from the UI are using relative paths to the repo root.

    How did you navigate to page with that error?
    I can reproduce that only when passing ?path=//some/path by hand.

     
  • Cory Johns - 2012-11-15

    I had a repo with one file and one subdir, foo, with one file in it. I browsed to the subdir normally, then clicked the History button, which gave me the path fragment ?path=/foo which gave that error. I get the error when viewing the history of any path on my mercurial repo.

    I think assuming the path is relative to the Hg repository is reasonable, though we should also gracefully handle errors from the hg call.

     
  • Igor Bondarenko - 2012-11-16
    • status: in-progress --> code-review
     
  • Igor Bondarenko - 2012-11-16

    Closed #209. Branch 42cc_5037b

     
  • Cory Johns - 2012-12-03
    • status: code-review --> closed
    • milestone: forge-backlog --> forge-dec-14
     
  • Anonymous - 2012-12-04

    Originally by: jacobsen

    It seems you're working on this, but I still +1'd it. Getting a display that lets you see the changes to a single file (e.g. http://jmri.svn.sourceforge.net/viewvc/jmri/trunk/jmri/java/src/jmri/jmrix/AbstractMRTrafficController.java?view=log which is a link to the functionality in our pre-update SVN) is how we in the JMRI project figure out who to involve when something regresses in released software. With lots of developers and lots of commits and lots of releases, the complexity is just overwhelming without a way to look at the history in this form.

     

Log in to post a comment.