Changeset 3d2daf2689d9…
Parent a45a536c6709…
by
Changes to 3 files · Browse files at 3d2daf2689d9 Showing diff from parent a45a536c6709 Diff from another changeset...
@@ -132,7 +132,7 @@ try:
from mercurial import subrepo, commands
- def genSubrepoRevChangedDescription(subrelpath, sfrom, sto):
+ def genSubrepoRevChangedDescription(subrelpath, sfrom, sto, repo):
"""Generate a subrepository revision change description"""
out = []
def getLog(_ui, srepo, opts):
@@ -195,7 +195,7 @@ srev = ctx.substate.get(wfile, subrepo.nullstate)[1]
srepo = None
try:
- subabspath = os.path.join(repo.root, wfile)
+ subabspath = os.path.join(ctx._repo.root, wfile)
if not os.path.isdir(subabspath):
sactual = ''
else:
@@ -226,13 +226,16 @@ sstatedesc = 'changed'
if ctx.rev() is not None:
sparent = ctx.p1().substate.get(wfile, subrepo.nullstate)[1]
- subrepochange, sstatedesc = genSubrepoRevChangedDescription(wfile, sparent, srev)
+ subrepochange, sstatedesc = \
+ genSubrepoRevChangedDescription(wfile, \
+ sparent, srev, ctx._repo)
out += subrepochange
else:
sstatedesc = 'dirty'
if srev != sactual:
subrepochange, sstatedesc = \
- genSubrepoRevChangedDescription(wfile, srev, sactual)
+ genSubrepoRevChangedDescription(wfile, \
+ srev, sactual, ctx._repo)
out += subrepochange
if data:
sstatedesc += ' and dirty'
|
@@ -216,54 +216,56 @@ e.addchild(p)
e = e[p]
- for st, files in status.iteritems():
- if path in files:
- # TODO: what if added & removed at once?
+ for st, filesofst in status.iteritems():
+ if path in filesofst:
e.setstatus(st)
break
else:
e.setstatus('C')
- roote = _Entry()
- ctx = self._repo[self._rev]
-
# Add subrepos to the tree
- subpaths = ctx.substate.keys()
- for path in subpaths:
- if not 'S' in self._statusfilter:
- break
- e = roote
- pathelements = hglib.tounicode(path).split('/')
- for p in pathelements[:-1]:
+ def addrepocontentstotree(roote, ctx):
+ subpaths = ctx.substate.keys()
+ for path in subpaths:
+ if not 'S' in self._statusfilter:
+ break
+ e = roote
+ pathelements = hglib.tounicode(path).split('/')
+ for p in pathelements[:-1]:
+ if not p in e:
+ e.addchild(p)
+ e = e[p]
+
+ p = pathelements[-1]
if not p in e:
e.addchild(p)
e = e[p]
-
- p = pathelements[-1]
- if not p in e:
- e.addchild(p)
- e = e[p]
- e.setstatus('S')
-
- # If the subrepo exists in the working directory
- # and it is a mercurial subrepo,
- # add the files that it contains to the tree as well, according ot
- # the status filter
- abspath = os.path.join(self._repo.root, path)
- if os.path.isdir(abspath):
- # Add subrepo files to the tree
- srev = ctx.substate[path][1]
- sub = ctx.sub(path)
- if isinstance(sub, hgsubrepo):
- srepo = sub._repo
- sctx = srepo[srev]
- status, uncleanpaths, files = getctxtreeinfo(sctx, srepo)
- addfilestotree(e, files, status, uncleanpaths)
-
- # Add regular files to the tree
- status, uncleanpaths, files = getctxtreeinfo(ctx, self._repo)
-
- addfilestotree(roote, files, status, uncleanpaths)
+ e.setstatus('S')
+
+ # If the subrepo exists in the working directory
+ # and it is a mercurial subrepo,
+ # add the files that it contains to the tree as well, according ot
+ # the status filter
+ abspath = os.path.join(ctx._repo.root, path)
+ if os.path.isdir(abspath):
+ # Add subrepo files to the tree
+ srev = ctx.substate[path][1]
+ sub = ctx.sub(path)
+ if isinstance(sub, hgsubrepo):
+ srepo = sub._repo
+ sctx = srepo[srev]
+ e = addrepocontentstotree(e, sctx)
+
+ # Add regular files to the tree
+ status, uncleanpaths, files = getctxtreeinfo(ctx, self._repo)
+
+ addfilestotree(roote, files, status, uncleanpaths)
+ return roote
+
+ roote = _Entry()
+ ctx = self._repo[self._rev]
+
+ addrepocontentstotree(roote, ctx)
roote.sort()
self.beginResetModel()
|
@@ -574,7 +574,7 @@ srev = ctx.substate[wsub][1]
sctx = ctx.sub(wsub)._repo[srev]
wfileinsub = wfile[len(wsub)+1:]
- if wfileinsub in sctx.files():
+ if wfileinsub in sctx.substate.keys() or wfileinsub in sctx.files():
return wsub, wfileinsub, sctx
else:
wsubsub, wfileinsub, sctx = \
|
Loading...