by
Changes to 3 files · Browse files at e94c42632f9c Showing diff from parent 801d3279c1c9 2ac800d3507c Diff from another changeset...
@@ -109,8 +109,14 @@ out = []
opts = {'date':None, 'user':None, 'rev':[sfrom]}
if not sfrom:
+ sstatedesc = 'new'
out.append(_('Subrepo initialized to revision:') + u'\n\n')
+ elif not sto:
+ sstatedesc = 'removed'
+ out.append(_('Subrepo removed from repository.') + u'\n\n')
+ return out, sstatedesc
else:
+ sstatedesc = 'changed'
out.append(_('Revision has changed from:') + u'\n\n')
_ui.pushbuffer()
commands.log(_ui, srepo, **opts)
@@ -119,17 +125,25 @@ opts['rev'] = [sto]
_ui.pushbuffer()
commands.log(_ui, srepo, **opts)
- out.append(hglib.tounicode(_ui.popbuffer()))
- return out
+ stolog = _ui.popbuffer()
+ if not stolog:
+ stolog = _('Initial revision')
+ out.append(hglib.tounicode(stolog))
+ return out, sstatedesc
srev = ctx.substate.get(wfile, subrepo.nullstate)[1]
- sub = ctx.sub(wfile)
- if isinstance(sub, subrepo.hgsubrepo):
+ try:
+ sub = ctx.sub(wfile)
+ if isinstance(sub, subrepo.hgsubrepo):
+ srepo = sub._repo
+ sactual = srepo['.'].hex()
+ else:
+ self.error = _('Not a Mercurial subrepo, not previewable')
+ return
+ except (util.Abort), e:
+ sub = ctx.p1().sub(wfile)
srepo = sub._repo
- sactual = srepo['.'].hex()
- else:
- self.error = _('Not a Mercurial subrepo, not previewable')
- return
+ sactual = ''
out = []
_ui = uimod.ui()
_ui.pushbuffer()
@@ -142,19 +156,22 @@ sstatedesc = 'changed'
if ctx.rev() is not None:
sparent = ctx.p1().substate.get(wfile, subrepo.nullstate)[1]
- out += genSubrepoRevChangedDescription(sparent, srev)
+ subrepochange, sstatedesc = genSubrepoRevChangedDescription(sparent, srev)
+ out += subrepochange
else:
- sstatedesc = 'dirty'
- if srev == '':
- sstatedesc = 'new'
- out.append(_('New subrepository') + u'\n\n')
- elif srev != sactual:
- sstatedesc = 'changed'
- out += genSubrepoRevChangedDescription(srev, sactual)
+ if srev != sactual:
+ subrepochange, sstatedesc = \
+ genSubrepoRevChangedDescription(srev, sactual)
+ out += subrepochange
+ if data:
+ sstatedesc += ' and dirty'
self.contents = u''.join(out)
+ if not sactual:
+ sstatedesc = 'removed'
self.flabel += _(' <i>(is a %s sub-repository)</i>' % sstatedesc)
- lbl = u' <a href="subrepo:%s">%s...</a>'
- self.flabel += lbl % (hglib.tounicode(srepo.root), _('open'))
+ if sactual:
+ lbl = u' <a href="subrepo:%s">%s...</a>'
+ self.flabel += lbl % (hglib.tounicode(srepo.root), _('open'))
except (EnvironmentError, error.RepoError, util.Abort), e:
self.error = _('Error previewing subrepo: %s') % \
hglib.tounicode(str(e))
|
@@ -103,6 +103,7 @@ if not isinstance(self._ctx, patchctx.patchctx):
if ".hgsubstate" in ctxfiles or ".hgsub" in ctxfiles:
from mercurial import subrepo
+ # Add the list of modified subrepos
for s, sd in self._ctx.substate.items():
srev = self._ctx.substate.get(s, subrepo.nullstate)[1]
sp1rev = self._ctx.p1().substate.get(s, subrepo.nullstate)[1]
@@ -112,7 +113,15 @@ if srev != sp1rev or (sp2rev != '' and srev != sp2rev):
wasmerged = ismerge and s in ctxfiles
files.append({'path': s, 'status': 'S', 'parent': parent,
- 'wasmerged': wasmerged})
+ 'wasmerged': wasmerged})
+ # Add the list of missing subrepos
+ subreposet = set(self._ctx.substate.keys())
+ subrepoparent1set = set(self._ctx.p1().substate.keys())
+ missingsubreposet = subrepoparent1set.difference(subreposet)
+ for s in missingsubreposet:
+ wasmerged = ismerge and s in ctxfiles
+ files.append({'path': s, 'status': 'S', 'parent': parent,
+ 'wasmerged': wasmerged})
if self._fulllist and ismerge:
func = lambda x: True
|
Loading...