M hgext3rd/confman/commands.py +5 -3
@@ 106,7 106,8 @@ def ensureconf(ui, repo, *args, **opts):
confman.checkout_section(
section, snaps, opts.get('keep_descendant', False)
)
- except Exception:
+ except Exception as err:
+ ui.write('%s\n' % err, label='confman.dirty')
return 1
ready[section] = rev
@@ 119,14 120,15 @@ def ensureconf(ui, repo, *args, **opts):
conf = confman.confs[section]
confman._check_parameters(section, False)
rev = snaps.get(conf['layout']) or conf.get('track', 'default')
- if ready.get(section) == rev:
+ if section in ready and ready[section] == rev:
continue
need_checkout.append((section, rev, conf))
for section, rev, conf in need_checkout:
try:
confman.checkout_section(section, snaps, opts.get('keep_descendant', False))
- except Exception:
+ except Exception as err:
+ ui.write('%s\n' % err, label='confman.dirty')
return 1
ready[section] = rev
M hgext3rd/confman/configuration.py +2 -4
@@ 205,11 205,9 @@ class configurationmanager(object):
repoclassbyconf(conf, path, self.hggit).clone(
self, source, dest, self.confs[section]
)
- except Exception as err:
+ except Exception:
# the clone operation did fail
self.failed.add(section)
- ui.write('%s\n' % err, label='confman.dirty')
- ui.debug(str(err))
shutil.rmtree(dest)
raise
@@ 243,7 241,7 @@ class configurationmanager(object):
if wctx.hex == snapshot:
return # already up to date
if managed.check_dirty(section):
- raise RuntimeError("could not checkout section %s" % section)
+ raise error.Abort("%s repo is unclean, please adjust" % section)
track = secconf.get('track')
rev = snapshot or track or 'default'
if managed.revsingle(rev, skiperror=True) == wctx:
M hgext3rd/confman/managed.py +1 -9
@@ 261,7 261,7 @@ class tgzrepo(managedrepo):
return rcbase()
def check_dirty(self, section):
- return rcbase()
+ return False
def revsingle(self, rev, skiperror=False):
return rcbase()
@@ 325,10 325,6 @@ class gitrepo(managedrepo):
def check_dirty(self, section):
changes = self.changestatus()
- if changes:
- self.ui.write(
- '%s repo is unclean, please adjust\n' % section, label='confman.dirty'
- )
return changes
def revsingle(self, rev, skiperror=False):
@@ 540,10 536,6 @@ class hgrepo(managedrepo):
def check_dirty(self, section):
"""Check and log the dirtyness of a repository"""
changes = self.repo[None].dirty(missing=True)
- if changes:
- self.ui.write(
- '%s repo is unclean, please adjust\n' % section, label='confman.dirty'
- )
return changes
def archive(self, zippath, prefix, rev, **opts):
M tests/test-tarball.t +2 -5
@@ 62,12 62,11 @@ contains the version number.
$ hg --traceback cfensureconf
cloning foo from file://../foo-1.0.0.tar.gz to $TESTTMP/conf/foo-1.0.0
+ foo
cloning quux from file://../quux.tar.gz to $TESTTMP/conf/quux-data
+ quux
cloning toto from file://../toto.zip to $TESTTMP/conf/toto-data
- foo
- quux
toto
- [1]
$ tree
.
@@ 100,7 99,6 @@ We can see that
foo
quux
toto
- [1]
# Now foo has a new release
@@ 131,7 129,6 @@ So, ensureconf download the new tarball
foo
quux
toto
- [1]
$ tree