Sun, 25 Apr 2010 15:03:41 +0000
Refined the Mercurial log browser and log dialog.
--- a/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html Sun Apr 25 12:38:46 2010 +0000 +++ b/Documentation/Source/eric5.Plugins.VcsPlugins.vcsMercurial.HgLogBrowserDialog.html Sun Apr 25 15:03:41 2010 +0000 @@ -246,7 +246,7 @@ </dd> </dl><a NAME="HgLogBrowserDialog.__generateFileItem" ID="HgLogBrowserDialog.__generateFileItem"></a> <h4>HgLogBrowserDialog.__generateFileItem</h4> -<b>__generateFileItem</b>(<i>action, path</i>) +<b>__generateFileItem</b>(<i>action, path, copyfrom</i>) <p> Private method to generate a changed files tree entry. </p><dl> @@ -256,6 +256,9 @@ </dd><dt><i>path</i></dt> <dd> path of the file in the repository (string) +</dd><dt><i>copyfrom</i></dt> +<dd> +path the file was copied from (string) </dd> </dl><dl> <dt>Returns:</dt>
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sun Apr 25 12:38:46 2010 +0000 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sun Apr 25 15:03:41 2010 +0000 @@ -385,17 +385,19 @@ return itm - def __generateFileItem(self, action, path): + def __generateFileItem(self, action, path, copyfrom): """ Private method to generate a changed files tree entry. @param action indicator for the change action ("A", "D" or "M") @param path path of the file in the repository (string) + @param copyfrom path the file was copied from (string) @return reference to the generated item (QTreeWidgetItem) """ itm = QTreeWidgetItem(self.filesTree, [ self.flags[action], path, + copyfrom, ]) return itm @@ -439,18 +441,9 @@ not self.fname == "." and \ not self.stopCheckBox.isChecked(): args.append('--follow') - args.append('--template') - args.append("change|{rev}:{node|short}\n" - "user|{author|email}\n" - "parents|{parents}\n" - "date|{date|isodate}\n" - "description|{desc}\n" - "file_adds|{file_adds}\n" - "files_mods|{file_mods}\n" - "file_dels|{file_dels}\n" - "branches|{branches}\n" - "tags|{tags}\n" - "@@@\n") + args.append('--copies') + args.append('--style') + args.append(os.path.join(os.path.dirname(__file__), "styles", "logBrowser.style")) if not self.projectMode: args.append(self.filename) @@ -532,6 +525,7 @@ log = {"message" : []} changedPaths = [] initialText = True + fileCopies = {} for s in self.buf: if s != "@@@\n": try: @@ -553,32 +547,47 @@ log["message"].append(value.strip()) elif key == "file_adds": if value.strip(): - for f in value.strip().split(): - changedPaths.append({\ - "action" : "A", - "path" : f, - }) + for f in value.strip().split(", "): + if f in fileCopies: + changedPaths.append({ + "action" : "A", + "path" : f, + "copyfrom" : fileCopies[f], + }) + else: + changedPaths.append({ + "action" : "A", + "path" : f, + "copyfrom" : "", + }) elif key == "files_mods": if value.strip(): - for f in value.strip().split(): - changedPaths.append({\ - "action" : "M", - "path" : f, + for f in value.strip().split(", "): + changedPaths.append({ + "action" : "M", + "path" : f, + "copyfrom" : "", }) elif key == "file_dels": if value.strip(): - for f in value.strip().split(): - changedPaths.append({\ - "action" : "D", - "path" : f, + for f in value.strip().split(", "): + changedPaths.append({ + "action" : "D", + "path" : f, + "copyfrom" : "", }) + elif key == "file_copies": + if value.strip(): + for entry in value.strip().split(", "): + newName, oldName = entry[:-1].split(" (") + fileCopies[newName] = oldName elif key == "branches": if value.strip(): - log["branches"] = value.strip().split() + log["branches"] = value.strip().split(", ") else: log["branches"] = ["default"] elif key == "tags": - log["tags"] = value.strip().split() + log["tags"] = value.strip().split(", ") else: if initialText: continue @@ -601,6 +610,7 @@ noEntries += 1 log = {"message" : []} changedPaths = [] + fileCopies = {} self.logTree.doItemsLayout() self.__resizeColumnsLog() @@ -694,7 +704,8 @@ changes = current.data(0, self.__changesRole) if len(changes) > 0: for change in changes: - self.__generateFileItem(change["action"], change["path"]) + self.__generateFileItem( + change["action"], change["path"], change["copyfrom"]) self.__resizeColumnsFiles() self.__resortFiles()
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.ui Sun Apr 25 12:38:46 2010 +0000 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.ui Sun Apr 25 15:03:41 2010 +0000 @@ -116,7 +116,7 @@ </property> <column> <property name="text"> - <string> </string> + <string/> </property> </column> <column> @@ -202,11 +202,6 @@ <string>Copy from</string> </property> </column> - <column> - <property name="text"> - <string>Copy from Rev</string> - </property> - </column> </widget> </item> <item>
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py Sun Apr 25 12:38:46 2010 +0000 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py Sun Apr 25 15:03:41 2010 +0000 @@ -112,18 +112,9 @@ if noEntries: args.append('--limit') args.append(str(noEntries)) - args.append('--template') - args.append("change|{rev}:{node|short}\n" - "branches|{branches}\n" - "tags|{tags}\n" - "parents|{parents}\n" - "user|{author}\n" - "date|{date|isodate}\n" - "description|{desc}\n" - "file_adds|{file_adds}\n" - "files_mods|{file_mods}\n" - "file_dels|{file_dels}\n" - "@@@\n") + args.append('--copies') + args.append('--style') + args.append(os.path.join(os.path.dirname(__file__), "styles", "logDialog.style")) if self.fname != "." or self.dname != repodir: args.append(self.filename) @@ -160,9 +151,11 @@ hasInitialText = 0 # three states flag (-1, 0, 1) lvers = 1 + fileCopies = {} for s in self.buf: if s == "@@@\n": self.contents.insertHtml('</p>{0}<br/>\n'.format(80 * "=")) + fileCopies = {} else: try: key, value = s.split("|", 1) @@ -216,24 +209,35 @@ elif key == "description": self.contents.insertHtml(Utilities.html_encode(value.strip())) self.contents.insertHtml('<br />\n') + elif key == "file_copies": + if value.strip(): + for entry in value.strip().split(", "): + newName, oldName = entry[:-1].split(" (") + fileCopies[newName] = oldName elif key == "file_adds": if value.strip(): self.contents.insertHtml('<br />\n') - for f in value.strip().split(): - self.contents.insertHtml( - self.trUtf8('Added {0}<br />\n')\ - .format(Utilities.html_encode(f))) + for f in value.strip().split(", "): + if f in fileCopies: + self.contents.insertHtml( + self.trUtf8('Added {0} (copied from {1})<br />\n')\ + .format(Utilities.html_encode(f), + Utilities.html_encode(fileCopies[f]))) + else: + self.contents.insertHtml( + self.trUtf8('Added {0}<br />\n')\ + .format(Utilities.html_encode(f))) elif key == "files_mods": if value.strip(): self.contents.insertHtml('<br />\n') - for f in value.strip().split(): + for f in value.strip().split(", "): self.contents.insertHtml( self.trUtf8('Modified {0}<br />\n')\ .format(Utilities.html_encode(f))) elif key == "file_dels": if value.strip(): self.contents.insertHtml('<br />\n') - for f in value.strip().split(): + for f in value.strip().split(", "): self.contents.insertHtml( self.trUtf8('Deleted {0}<br />\n')\ .format(Utilities.html_encode(f)))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/VcsPlugins/vcsMercurial/styles/logBrowser.style Sun Apr 25 15:03:41 2010 +0000 @@ -0,0 +1,13 @@ +changeset = 'change|{rev}:{node|short}\nuser|{author|email}\nparents|{parents}\ndate|{date|isodate}\ndescription|{desc}\nfile_copies|{file_copies}\nfile_adds|{file_adds}\nfiles_mods|{file_mods}\nfile_dels|{file_dels}\nbranches|{branches}\ntags|{tags}\n@@@\n' +file_mod = '{file_mod}, ' +last_file_mod = '{file_mod}' +file_add = '{file_add}, ' +last_file_add = '{file_add}' +file_del = '{file_del}, ' +last_file_del = '{file_del}' +file_copy = '{name} ({source}), ' +last_file_copy = '{name} ({source})' +tag = '{tag}, ' +last_tag = '{tag}' +branch = '{branch}, ' +last_branch = '{branch}'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Plugins/VcsPlugins/vcsMercurial/styles/logDialog.style Sun Apr 25 15:03:41 2010 +0000 @@ -0,0 +1,13 @@ +changeset = 'change|{rev}:{node|short}\nbranches|{branches}\ntags|{tags}\nparents|{parents}\nuser|{author}\ndate|{date|isodate}\ndescription|{desc}\nfile_copies|{file_copies}\nfile_adds|{file_adds}\nfiles_mods|{file_mods}\nfile_dels|{file_dels}\n@@@\n' +file_mod = '{file_mod}, ' +last_file_mod = '{file_mod}' +file_add = '{file_add}, ' +last_file_add = '{file_add}' +file_del = '{file_del}, ' +last_file_del = '{file_del}' +file_copy = '{name} ({source}), ' +last_file_copy = '{name} ({source})' +tag = '{tag}, ' +last_tag = '{tag}' +branch = '{branch}, ' +last_branch = '{branch}'
--- a/eric5.e4p Sun Apr 25 12:38:46 2010 +0000 +++ b/eric5.e4p Sun Apr 25 15:03:41 2010 +0000 @@ -1103,6 +1103,8 @@ <Other>eric5.desktop</Other> <Other>Plugins/VcsPlugins/vcsMercurial/icons/mercurial.png</Other> <Other>Plugins/VcsPlugins/vcsMercurial/icons/preferences-mercurial.png</Other> + <Other>Plugins/VcsPlugins/vcsMercurial/styles/logBrowser.style</Other> + <Other>Plugins/VcsPlugins/vcsMercurial/styles/logDialog.style</Other> </Others> <MainScript>eric5.py</MainScript> <Vcs>
--- a/install.py Sun Apr 25 12:38:46 2010 +0000 +++ b/install.py Sun Apr 25 15:03:41 2010 +0000 @@ -341,7 +341,7 @@ copyTree('eric', cfg['ericDir'], ['*.rb'], ['eric%sExamples' % os.sep]) copyTree('eric%sPlugins' % os.sep, '%s%sPlugins' % (cfg['ericDir'], os.sep), - ['*.png']) + ['*.png', '*.style']) copyTree('eric%sDocumentation' % os.sep, cfg['ericDocDir'], ['*.html', '*.qch']) copyTree('eric%sDTDs' % os.sep, cfg['ericDTDDir'], ['*.dtd']) copyTree('eric%sCSSs' % os.sep, cfg['ericCSSDir'], ['*.css'])