--- a/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py Wed Apr 28 15:41:48 2010 +0000 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py Wed Apr 28 17:17:09 2010 +0000 @@ -63,12 +63,13 @@ self.revisions = [] # stack of remembered revisions self.revString = self.trUtf8('Revision') + self.projectMode = False - self.logEntries = [] # list of log entries - self.lastLogEntry = {} + self.logEntries = [] # list of log entries + self.lastLogEntry = {} self.fileCopies = {} - self.endInitialText = False - self.initialText = "" + self.endInitialText = False + self.initialText = [] self.diff = None @@ -107,6 +108,8 @@ if self.repodir == os.sep: return + self.projectMode = (self.fname == "." and self.dname == self.repodir) + self.process.kill() self.activateWindow() @@ -131,7 +134,7 @@ project.getProjectManagementDir(), "hg-bundle.hg") args.append('--bundle') args.append(self.vcs.bundleFile) - if self.fname != "." or self.dname != self.repodir: + if not self.projectMode: args.append(self.filename) self.process.setWorkingDirectory(self.repodir) @@ -159,15 +162,16 @@ process = QProcess() args = [] - args.append("parents") - if self.commandMode == "incoming" and self.vcs.bundleFile: - args.append("--repository") + args.append("parents") + if self.mode == "incoming" and self.vcs.bundleFile: + args.append("--repository") args.append(self.vcs.bundleFile) args.append("--template") args.append("{rev}:{node|short}\n") args.append("-r") args.append(rev) - args.append(self.filename) + if not self.projectMode: + args.append(self.filename) process.setWorkingDirectory(self.repodir) process.start('hg', args) @@ -210,22 +214,27 @@ .format(self.filename)) self.errorGroup.show() return - - if self.initialText: - self.contents.insertHtml(Utilities.html_encode(self.initialText.strip())) - self.contents.insertHtml('<br />\n') + + if self.initialText: + for line in self.initialText: + self.contents.insertHtml(Utilities.html_encode(line.strip())) + self.contents.insertHtml('<br />\n') self.contents.insertHtml('{0}<br/>\n'.format(80 * "=")) for entry in self.logEntries: - fileCopies = {} - for fentry in entry["file_copies"].split(", "): - newName, oldName = entry[:-1].split(" (") - fileCopies[newName] = oldName - - rev, hexRev = entry["change"].split(":") - dstr = '<p><b>{0} {1}</b>'.format(self.revString, entry["change"]) - parents = self.__getParents(rev) - for parent in parents: + fileCopies = {} + if entry["file_copies"]: + for fentry in entry["file_copies"].split(", "): + newName, oldName = fentry[:-1].split(" (") + fileCopies[newName] = oldName + + rev, hexRev = entry["change"].split(":") + dstr = '<p><b>{0} {1}</b>'.format(self.revString, entry["change"]) + if entry["parents"]: + parents = entry["parents"].split() + else: + parents = self.__getParents(rev) + for parent in parents: url = QUrl() url.setScheme("file") url.setPath(self.filename) @@ -238,29 +247,29 @@ self.trUtf8('diff to {0}').format(parent), ) dstr += '<br />\n' - self.contents.insertHtml(dstr) - + self.contents.insertHtml(dstr) + self.contents.insertHtml(self.trUtf8("Branches: {0}<br />\n")\ .format(entry["branches"])) - + self.contents.insertHtml(self.trUtf8("Tags: {0}<br />\n")\ .format(entry["tags"])) - + self.contents.insertHtml(self.trUtf8("Parents: {0}<br />\n")\ .format(entry["parents"])) - - self.contents.insertHtml(self.trUtf8('<i>Author: {0}</i><br />\n')\ + + self.contents.insertHtml(self.trUtf8('<i>Author: {0}</i><br />\n')\ .format(entry["user"])) - + date, time = entry["date"].split()[:2] self.contents.insertHtml(self.trUtf8('<i>Date: {0}, {1}</i><br />\n')\ .format(date, time)) - - for line in entry["description"]: + + for line in entry["description"]: self.contents.insertHtml(Utilities.html_encode(line.strip())) self.contents.insertHtml('<br />\n') - - if entry["file_adds"]: + + if entry["file_adds"]: self.contents.insertHtml('<br />\n') for f in entry["file_adds"].strip().split(", "): if f in fileCopies: @@ -272,15 +281,15 @@ self.contents.insertHtml( self.trUtf8('Added {0}<br />\n')\ .format(Utilities.html_encode(f))) - - if entry["files_mods"]: + + if entry["files_mods"]: self.contents.insertHtml('<br />\n') for f in entry["files_mods"].strip().split(", "): self.contents.insertHtml( self.trUtf8('Modified {0}<br />\n')\ .format(Utilities.html_encode(f))) - - if entry["file_dels"]: + + if entry["file_dels"]: self.contents.insertHtml('<br />\n') for f in entry["file_dels"].strip().split(", "): self.contents.insertHtml( @@ -311,11 +320,11 @@ ## if line.startswith("change|"): ## ver = line[7:] ## # save revision number for later use -## self.revisions.append(ver) +## self.revisions.append(ver) - if s == "@@@\n": + if s == "@@@\n": self.logEntries.append(self.lastLogEntry) - self.lastLogEntry = {} + self.lastLogEntry = {} self.fileCopies = {} else: try: @@ -325,17 +334,17 @@ value = s if key == "change": self.endInitialText = True - if key in ("change", "branches", "tags", "parents", "user", - "date", "file_copies", "file_adds", "files_mods", - "file_dels"): + if key in ("change", "branches", "tags", "parents", "user", + "date", "file_copies", "file_adds", "files_mods", + "file_dels"): self.lastLogEntry[key] = value.strip() - elif key == "description": + elif key == "description": self.lastLogEntry[key] = [value.strip()] - else: - if self.endInitialText: + else: + if self.endInitialText: self.lastLogEntry["description"].append(value.strip()) - else: - self.initialText.append(value) + else: + self.initialText.append(value) def __readStderr(self): """