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.
# Copyright 2011 Ryan Seto <mr.werewolf@gmail.com>## rupdate.py - Remote Update dialog for TortoiseHg## This dialog lets users update a remote ssh repository.## Requires a copy of the rupdate plugin found at:# http://bitbucket.org/MrWerewolf/rupdate## Also, enable the plugin with the following in mercurial.ini:## [extensions]# rupdate = /path/to/rupdate### This software may be used and distributed according to the terms of the# GNU General Public License version 2, incorporated herein by reference.fromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*frommercurialimporterror,node,mergeasmergemodfromtortoisehg.utilimporthglib,pathsfromtortoisehg.hgqt.i18nimport_fromtortoisehg.hgqtimportcmdui,csinfo,qtlib,thgrepo,resolvefromtortoisehg.hgqt.updateimportUpdateDialogclassrUpdateDialog(UpdateDialog):def__init__(self,repo,rev=None,parent=None,opts={}):super(rUpdateDialog,self).__init__(repo,rev,parent,opts)# Get configured pathsself.paths={}fn=self.repo.join('hgrc')fn,cfg=qtlib.loadIniFile([fn],self)if'paths'incfg:foraliasincfg['paths']:self.paths[alias]=cfg['paths'][alias]### target path comboself.path_combo=pcombo=QComboBox()pcombo.setEditable(True)foraliasinself.paths:pcombo.addItem(hglib.tounicode(self.paths[alias]))### shift existing items down a row.foriinrange(self.grid.count()-1,-1,-1):row,col,rowSp,colSp=self.grid.getItemPosition(i)item=self.grid.takeAt(i)self.grid.removeItem(item)self.grid.addItem(item,row+1,col,rowSp,colSp,item.alignment())### add target path combo to gridself.grid.addWidget(QLabel(_('Location:')),0,0)self.grid.addWidget(pcombo,0,1)### Optionsself.push_chk=QCheckBox(_('Perform a push before updating'' (-p/--push)'))self.newbranch_chk=QCheckBox(_('Allow pushing new branches'' (--new-branch)'))self.force_chk=QCheckBox(_('Force push to remote location'' (-f/--force)'))self.optbox.removeWidget(self.showlog_chk)self.optbox.addWidget(self.push_chk)self.optbox.addWidget(self.newbranch_chk) self.optbox.addWidget(self.force_chk)
self.optbox.addWidget(self.showlog_chk)
+ #### Persisted Options+ self.push_chk.setChecked(+ QSettings().value('rupdate/push', False).toBool())++ self.newbranch_chk.setChecked(+ QSettings().value('rupdate/newbranch', False).toBool())++ self.showlog_chk.setChecked(+ QSettings().value('rupdate/showlog', False).toBool())+ # prepare to show
self.push_chk.setHidden(True)
self.newbranch_chk.setHidden(True)
self.force_chk.setHidden(True)
+ self.showlog_chk.setHidden(True) self.update_info()
+ # expand options if a hidden one is checked+ self.show_options(self.hiddenSettingIsChecked())+ ### Private Methods ###
+ def hiddenSettingIsChecked(self):+ # This might be called from the super class before all options are built.+ # So, we need to check to make sure these options exist first.+ if (getattr(self, "push_chk", None) and self.push_chk.isChecked()+ ) or (getattr(self, "newbranch_chk", None) and self.newbranch_chk.isChecked()+ ) or (getattr(self, "force_chk", None) and self.force_chk.isChecked()+ ) or (getattr(self, "showlog_chk", None) and self.showlog_chk.isChecked()):+ return True+ else:+ return False++ def saveSettings(self):+ QSettings().setValue('rupdate/push', self.push_chk.isChecked())+ QSettings().setValue('rupdate/newbranch', self.newbranch_chk.isChecked())+ QSettings().setValue('rupdate/showlog', self.showlog_chk.isChecked())+ def update_info(self):
super(rUpdateDialog, self).update_info()
# Keep update button enabled. self.update_btn.setDisabled(False)
def update(self):
+ self.saveSettings() cmdline = ['rupdate']
if self.discard_chk.isChecked():
cmdline.append('--clean')ifself.push_chk.isChecked():cmdline.append('--push')ifself.newbranch_chk.isChecked():cmdline.append('--new-branch')ifself.force_chk.isChecked():cmdline.append('--force')dest=hglib.fromunicode(self.path_combo.currentText())cmdline.append('-d')cmdline.append(dest)# Refer to the revision by the short hash.rev=hglib.fromunicode(self.rev_combo.currentText())revShortHash=node.short(self.repo[rev].node())cmdline.append(revShortHash)# start updatingself.repo.incrementBusyCount()self.cmd.run(cmdline) ### Signal Handlers ###
def show_options(self, visible):
- self.push_chk.setShown(visible)
- self.newbranch_chk.setShown(visible)
- self.force_chk.setShown(visible)
- self.showlog_chk.setShown(visible)
+ # Like hiddenSettingIsChecked(), need to make sure these options exist first.+ if getattr(self, "push_chk", None): self.push_chk.setShown(visible)
+if getattr(self, "newbranch_chk", None): self.newbranch_chk.setShown(visible)
+ if getattr(self, "force_chk", None): self.force_chk.setShown(visible)
+if getattr(self, "showlog_chk", None): self.showlog_chk.setShown(visible)
def command_started(self):
super(rUpdateDialog, self).command_started()
self.update_btn.setHidden(False)defrun(ui,*pats,**opts):fromtortoisehg.utilimportpathsrepo=thgrepo.repository(ui,path=paths.find_root())rev=Noneifopts.get('rev'):rev=opts.get('rev')eliflen(pats)==1:rev=pats[0]returnrUpdateDialog(repo,rev,None,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.