Peter Suter avatar Peter Suter committed a9fa26c

Create HGRC file with description and contact information.

Comments (0)

Files changed (2)

hgdirmanager/hgdirmanager.py

                     except Exception, e:
                         add_warning(req, _('Failed to create repository: ') + str(e))
                     else:
+                        description = req.args.get('field_description')
+                        contact = req.args.get('field_contact')
+                        url_prefix = self.config.get('hgdir', 'url_prefix')
+                        hgrcpath = os.path.join(repodir,  '.hg', 'hgrc')
+                        with open(hgrcpath, 'w') as f:
+                            f.write('[web]\n')
+                            f.write('contact = %s\n' % contact)
+                            f.write('description = %s\n' % description)
+                            f.write('baseurl = %s\n' % url_prefix)
+                        
                         RepositoryManager(self.env).reload_repositories()
                         req.redirect(req.href.wiki())
 

hgdirmanager/templates/newhgrepo.html

                     <input type="text" id="field-name" name="field_name" size="70" />
                   </td>
                 </tr>
+                <tr>
+                  <th><label for="field-description">Description:</label></th>
+                  <td class="fullrow" colspan="3">
+                    <input type="text" id="field-description" name="field_description" size="70" />
+                  </td>
+                </tr>
+                <tr>
+                  <th><label for="field-contact">Contact:</label></th>
+                  <td class="fullrow" colspan="3">
+                    <input type="text" id="field-contact" name="field_contact" size="70" />
+                  </td>
+                </tr>
               </table>
             </fieldset>
           </div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.