Edgewall Software

Opened 12 years ago

Closed 6 years ago

Last modified 4 years ago

#10603 closed enhancement (fixed)

GitPlugin: Support for submodules — at Version 15

Reported by: Peter Suter Owned by: Jun Omae
Priority: low Milestone: 1.0.17
Component: plugin/git Version: 1.0dev
Severity: normal Keywords: subrepository git-submodule
Cc: lele@…, Jun Omae Branch:
Release Notes:

Support submodule entries in Git repository.

API Changes:
Internal Changes:

Description

Created as part of the move of GitPlugin. Tickets originally reported for th:GitPlugin: th:#8880, th:#3842

Quoting mresnick:

Is anyone working on submodule support in the source browser ?

From the git_fs.py file:

pass # FIXME: this is a workaround for missing git submodule support in the plugin

Particularly for TRAC 0.12 which supports multiple repositories it should be possible to switch context to display submodule files.

Quoting anonymous:

Error[1] apears when change contains only submodule version update. Same error can be reproduced when change contains information about merge branch into master.

[1] TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Change History (16)

comment:1 by anonymous, 12 years ago

Is this going to get implemented at some point?

comment:2 by Christian Boos, 12 years ago

Well, we can't do much until someone contributes a repository icon ;-)

in reply to:  description comment:3 by Peter Suter, 11 years ago

Quoting anonymous:

Error[1] apears when change contains only submodule version update. Same error can be reproduced when change contains information about merge branch into master.

[1] TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

This part is a duplicate of #10162.

comment:4 by Peter Suter, 11 years ago

Keywords: subrepository added

But as comment:3:ticket:10162 suggests, maybe we can for now treat subrepositories as directories. Changing GitRepository.get_changes() and GitChangeset.get_changes() from everything except directories are files to the reverse perhaps?

kind = Node.DIRECTORY
if mode2.startswith('10') or mode1.startswith('10'):
    kind = Node.FILE

(untested)

comment:5 by Christian Boos, 11 years ago

Milestone: next-major-releases
Priority: normallow
Version: 1.0dev

comment:6 by Jun Omae, 11 years ago

#11183 was closed as duplicate.

comment:7 by Lele Gaifax, 10 years ago

Cc: lele@… added

here is another possible workaround to the problem.

comment:8 by Jun Omae, 10 years ago

Cc: Jun Omae added
Keywords: git-submodule added
Milestone: next-major-releasesnext-stable-1.0.x

comment:9 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:10 by Jun Omae, 6 years ago

I got TypeErrors under production environment. At least, I think we should prevent the TypeErrors even if #10162 is not resolved.

comment:11 by Jun Omae, 6 years ago

Milestone: next-stable-1.2.x1.0.17
Owner: set to Jun Omae
Status: newassigned

Proposed changes in [5148072ee/jomae.git] (jomae.git@t10603).

comment:12 by Jun Omae, 6 years ago

Reconsidering, submodule'd entry should be a directory. In proposed changes, that would be a file.

$ git submodule add -b 1.0-stable --name trac git@github.com:edgewall/trac.git trac
Cloning into 'trac'...
remote: Counting objects: 96491, done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 96491 (delta 18), reused 17 (delta 8), pack-reused 96439
Receiving objects: 100% (96491/96491), 35.90 MiB | 54.00 KiB/s, done.
Resolving deltas: 100% (76657/76657), done.
Checking connectivity... done.
$ git commit -a -m 'add submodule'
[master (root-commit) a35122f40] add submodule
 2 files changed, 5 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 trac
$ git archive --format=tar --prefix=./ HEAD | tar tvf -
drwxrwxr-x root/root         0 2017-12-11 12:05 ./
-rw-rw-r-- root/root        93 2017-12-11 12:05 ./.gitmodules
drwxrwxr-x root/root         0 2017-12-11 12:05 ./trac/           # <== directory

I'll re-propose changes.

Last edited 6 years ago by Jun Omae (previous) (diff)

comment:13 by Jun Omae, 6 years ago

Proposed changes in [ab9e4aaa8/jomae.git] (jomae.git@t10603.1), again.

In the changes, GitNode.kind for submodule'd entry is Node.DIRECTORY and referenced sha in the submodule is stored in commit of GitNode.properties().

>>> from trac.env import Environment
>>> from trac.versioncontrol.api import RepositoryManager
>>> env = Environment('/dev/shm/tracenv')
>>> rm = RepositoryManager(env)
>>> repos = rm.get_repository('')
>>> node = repos.get_node('/sub')
>>> node.kind
'dir'
>>> node.get_properties()
{'commit': 'c392cf2e6a537dc3efe797576efad365a0fbeade', 'mode': '160000'}
>>> node.get_content() is None
True
>>> node.get_content_length() is None
True

in reply to:  13 comment:14 by Jun Omae, 6 years ago

Replying to Jun Omae:

Proposed changes in [ab9e4aaa8/jomae.git] (jomae.git@t10603.1), again.

Revised the branch. Fixed GitNode.get_entries() returns a list included itself.

comment:15 by Jun Omae, 6 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [16409] and merged in [16410-16411].

by Ryan J Ollos, 4 years ago

Note: See TracTickets for help on using tickets.