Mercurial > hg
changeset 4954:90be978c9d3d
merge with crew-stable
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 19 Jul 2007 19:48:24 -0300 |
parents | 2f0f9528e77b (current diff) 6b3ed43f77ba (diff) |
children | 9bbc0217209b |
files | mercurial/commands.py |
diffstat | 5 files changed, 68 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/archival.py Thu Jul 19 15:33:21 2007 -0700 +++ b/mercurial/archival.py Thu Jul 19 19:48:24 2007 -0300 @@ -200,8 +200,9 @@ prefix is name of path to put before every archive member.''' - def write(name, mode, islink, data): + def write(name, mode, islink, getdata): if matchfn and not matchfn(name): return + data = getdata() if decode: data = repo.wwritedata(name, data) archiver.addfile(name, mode, islink, data) @@ -212,8 +213,8 @@ items = m.items() items.sort() write('.hg_archival.txt', 0644, False, - 'repo: %s\nnode: %s\n' % (hex(repo.changelog.node(0)), hex(node))) + lambda: 'repo: %s\nnode: %s\n' % (hex(repo.changelog.node(0)), hex(node))) for filename, filenode in items: write(filename, m.execf(filename) and 0755 or 0644, m.linkf(filename), - repo.file(filename).read(filenode)) + lambda: repo.file(filename).read(filenode)) archiver.done()
--- a/mercurial/commands.py Thu Jul 19 15:33:21 2007 -0700 +++ b/mercurial/commands.py Thu Jul 19 19:48:24 2007 -0300 @@ -1355,7 +1355,7 @@ addglobalopts(False) - def helplist(select=None): + def helplist(header, select=None): h = {} cmds = {} for c, e in table.items(): @@ -1373,6 +1373,11 @@ h[f] = doc.splitlines(0)[0].rstrip() cmds[f] = c.lstrip("^") + if not h: + ui.status(_('no commands defined\n')) + return + + ui.status(header) fns = h.keys() fns.sort() m = max(map(len, fns)) @@ -1422,14 +1427,10 @@ try: ct = mod.cmdtable except AttributeError: - ct = None - if not ct: - ui.status(_('no commands defined\n')) - return - - ui.status(_('list of commands:\n\n')) + ct = {} + modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct]) - helplist(modcmds.has_key) + helplist(_('list of commands:\n\n'), modcmds.has_key) if name and name != 'shortlist': i = None @@ -1453,11 +1454,11 @@ # list of commands if name == "shortlist": - ui.status(_('basic commands:\n\n')) + header = _('basic commands:\n\n') else: - ui.status(_('list of commands:\n\n')) - - helplist() + header = _('list of commands:\n\n') + + helplist(header) # list all option lists opt_output = []
--- a/mercurial/dirstate.py Thu Jul 19 15:33:21 2007 -0700 +++ b/mercurial/dirstate.py Thu Jul 19 19:48:24 2007 -0300 @@ -21,6 +21,7 @@ self._opener = opener self._root = root self._dirty = 0 + self._dirtypl = 0 self._ui = ui def __getattr__(self, name): @@ -114,6 +115,7 @@ def setparents(self, p1, p2=nullid): self.markdirty() + self._dirtypl = 1 self._pl = p1, p2 def setbranch(self, branch): @@ -126,7 +128,8 @@ def _read(self): self._map = {} self._copymap = {} - self._pl = [nullid, nullid] + if not self._dirtypl: + self._pl = [nullid, nullid] try: st = self._opener("dirstate").read() except IOError, err: @@ -135,7 +138,8 @@ if not st: return - self._pl = [st[:20], st[20: 40]] + if not self._dirtypl: + self._pl = [st[:20], st[20: 40]] # deref fields so they will be local in loop dmap = self._map @@ -160,8 +164,8 @@ def invalidate(self): for a in "_map _copymap _branch _pl _dirs _ignore".split(): - if hasattr(self, a): - self.__delattr__(a) + if a in self.__dict__: + delattr(self, a) self._dirty = 0 def copy(self, source, dest): @@ -262,6 +266,7 @@ st.write(cs.getvalue()) st.rename() self._dirty = 0 + self._dirtypl = 0 def filterfiles(self, files): ret = {}
--- a/tests/test-extension Thu Jul 19 15:33:21 2007 -0700 +++ b/tests/test-extension Thu Jul 19 19:48:24 2007 -0300 @@ -64,3 +64,18 @@ echo '[extensions]' > $HGRCPATH echo "empty = $emptypath" >> $HGRCPATH hg help empty + +cat > debugextension.py <<EOF +'''only debugcommands +''' +def debugfoobar(ui, repo, *args, **opts): + "yet another debug command" + pass + +cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")} +EOF +debugpath=`pwd`/debugextension.py +echo '[extensions]' > $HGRCPATH +echo "debugextension = $debugpath" >> $HGRCPATH +hg help debugextension +hg --debug help debugextension
--- a/tests/test-extension.out Thu Jul 19 15:33:21 2007 -0700 +++ b/tests/test-extension.out Thu Jul 19 19:48:24 2007 -0300 @@ -22,3 +22,30 @@ empty extension - empty cmdtable no commands defined +debugextension extension - only debugcommands + +no commands defined +debugextension extension - only debugcommands + +list of commands: + + debugfoobar: + yet another debug command + +global options: + -R --repository repository root directory or symbolic path name + --cwd change working directory + -y --noninteractive do not prompt, assume 'yes' for any required answers + -q --quiet suppress output + -v --verbose enable additional output + --config set/override config option + --debug enable debugging output + --debugger start debugger + --encoding set the charset encoding (default: ascii) + --encodingmode set the charset encoding mode (default: strict) + --lsprof print improved command execution profile + --traceback print traceback on exception + --time time how long the command takes + --profile print command execution profile + --version output version information and exit + -h --help display help and exit