Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
#
# hgignore.py - TortoiseHg's dialog for editing .hgignore
#
-# Copyright (C) 2008 Steve Borho <steve@borho.org>
+# Copyright (C) 2008-2009 Steve Borho <steve@borho.org>
#
import os
-import gobjectimport gtk
-import pango-import stringfrom dialog import *
import hglib
-from mercurial import hg, ui
+from mercurial import hg, ui, matchclass HgIgnoreDialog(gtk.Window):
""" Edit a reposiory .hgignore file """
def__init__(self,root=''):""" Initialize the Dialog """gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)self.root=rootself.set_title('Ignore mask for '+os.path.basename(root))self.set_default_size(630,400)self.tbar=gtk.Toolbar()self.tips=gtk.Tooltips()sep=gtk.SeparatorToolItem()sep.set_expand(True)sep.set_draw(False)self._btn_close=self._toolbutton(gtk.STOCK_CLOSE,'Close',self._close_clicked,'Close Window')tbuttons=[self._toolbutton(gtk.STOCK_REFRESH,'Refresh',self._refresh_clicked,tip='Reload hgignore'),sep,self._btn_close]forbtnintbuttons:self.tbar.insert(btn,-1)mainvbox=gtk.VBox()self.add(mainvbox)mainvbox.pack_start(self.tbar,False,False,2)hbox=gtk.HBox()lbl=gtk.Label('Glob:')lbl.set_property("width-chars",7)lbl.set_alignment(1.0,0.5)hbox.pack_start(lbl,False,False,4)glob_entry=gtk.Entry()hbox.pack_start(glob_entry,True,True,4)glob_button=gtk.Button('add')hbox.pack_start(glob_button,False,False,4)glob_button.connect('clicked',self.add_glob,glob_entry)glob_entry.connect('activate',self.add_glob,glob_entry)mainvbox.pack_start(hbox,False,False)hbox=gtk.HBox()lbl=gtk.Label('Regexp:')lbl.set_property("width-chars",7)lbl.set_alignment(1.0,0.5)hbox.pack_start(lbl,False,False,4)regexp_entry=gtk.Entry()hbox.pack_start(regexp_entry,True,True,4)regexp_button=gtk.Button('add')hbox.pack_start(regexp_button,False,False,4)regexp_button.connect('clicked',self.add_regexp,regexp_entry)regexp_entry.connect('activate',self.add_regexp,regexp_entry)mainvbox.pack_start(hbox,False,False)hbox=gtk.HBox()frame=gtk.Frame('Filters')hbox.pack_start(frame,True,True,4)pattree=gtk.TreeView()sel=pattree.get_selection()sel.connect("changed",self.pattern_rowchanged)col=gtk.TreeViewColumn('Patterns',gtk.CellRendererText(),text=0)pattree.append_column(col)scrolledwindow=gtk.ScrolledWindow()scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)scrolledwindow.set_border_width(4)scrolledwindow.add(pattree)pattree.set_headers_visible(False) self.pattree = pattree
frame.add(scrolledwindow)
- frame = gtk.Frame('Unknown Files')
hbox.pack_start(frame, True, True, 4)
unknowntree = gtk.TreeView()
sel=unknowntree.get_selection()sel.connect("changed",self.unknown_rowchanged)col=gtk.TreeViewColumn('Files',gtk.CellRendererText(),text=0)unknowntree.append_column(col)scrolledwindow=gtk.ScrolledWindow() scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrolledwindow.set_border_width(4)
scrolledwindow.add(unknowntree)
- model = gtk.ListStore(gobject.TYPE_STRING)
+ model = gtk.ListStore(str)
unknowntree.set_model(model)
unknowntree.set_headers_visible(False)
+ self.unkmodel = model frame.add(scrolledwindow)
mainvbox.pack_start(hbox, True, True)
glob_entry.grab_focus()self.connect('map_event',self._on_window_map_event)defpattern_rowchanged(self,sel):model,iter=sel.get_selected()ifnotiter:returndefunknown_rowchanged(self,sel):model,iter=sel.get_selected()ifnotiter:returndefadd_glob(self,widget,glob_entry):passdefadd_regexp(self,widget,glob_entry):passdef_on_window_map_event(self,event,param):self._refresh_clicked(None)def_refresh_clicked(self,togglebutton,data=None):try:l=open(os.path.join(self.root,'.hgignore'),'rb').readlines()ifl[0].endswith('\r\n'):self.doseoln=TrueexceptIOError,ValueError: self.doseoln = os.name == 'nt'
l = []
- model = gtk.ListStore(gobject.TYPE_STRING)
- l = [string.strip(line) for line in l]+ model = gtk.ListStore(str)
for line in l:
- model.append([line])
+ model.append([line.strip()])
self.pattree.set_model(model)
self.ignorelines = l
+ try: repo = hg.repository(ui.ui(), path=self.root)+ except:+ print 'no repository found'+ gtk.main_quit()++ matcher = match.always(repo.root, repo.root)+ changes = repo.dirstate.status(matcher, ignored=False, clean=False, unknown=True)+ (lookup, modified, added, removed, deleted, unknown, ignored, clean) = changes+ self.unkmodel.clear()+ for u in unknown:+ self.unkmodel.append([u])+ def write_ignore_lines(self):
if doseoln:
out = [line + '\r\n' for line in self.ignorelines]
else:out=[line+'\n'forlineinself.ignorelines]try:f=open(os.path.join(self.root,'.hgignore'),'wb')f.writelines(out)f.close()exceptIOError:passdef_close_clicked(self,toolbutton,data=None):self.destroy()def_toolbutton(self,stock,label,handler,tip):tbutton=gtk.ToolButton(stock)tbutton.set_label(label)tbutton.set_tooltip(self.tips,tip)tbutton.connect('clicked',handler)returntbuttondefrun(root='',**opts):dialog=HgIgnoreDialog(root)dialog.show_all()dialog.connect('destroy',gtk.main_quit)gtk.gdk.threads_init()gtk.gdk.threads_enter()gtk.main()gtk.gdk.threads_leave()if__name__=="__main__":opts={'root':hglib.rootpath()}run(**opts)
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.