# HG changeset patch # User jrice@netbeans.org # Date 1207132608 -3600 # Node ID 208cabf1e10e907b36e33837e1739818f69cfb14 # Parent 9708b64d41e632fbb33f6ae26331921a5e36344d #131794: in Mercurial->Properties only checking .hg/hgrc for pUsh/Pull need to check system/ global as well diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/HgModuleConfig.java --- a/mercurial/src/org/netbeans/modules/mercurial/HgModuleConfig.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/HgModuleConfig.java Wed Apr 02 11:36:48 2008 +0100 @@ -198,8 +198,8 @@ public class HgModuleConfig { * or /etc/mercurial/hgrc * or a default username if none is found. */ - public String getUserName() { - userName = HgConfigFiles.getInstance().getUserName(); + public String getSysUserName() { + userName = HgConfigFiles.getSysInstance().getSysUserName(); if (userName.length() == 0) { String userId = System.getProperty("user.name"); // NOI18N String hostName; @@ -213,16 +213,24 @@ public class HgModuleConfig { return userName; } + public String getSysPushPath() { + return HgConfigFiles.getSysInstance().getSysPushPath(); + } + + public String getSysPullPath() { + return HgConfigFiles.getSysInstance().getSysPullPath(); + } + public void addHgkExtension() { - HgConfigFiles.getInstance().setProperty("hgext.hgk", ""); + HgConfigFiles.getSysInstance().setProperty("hgext.hgk", ""); } public void setUserName(String name) { - HgConfigFiles.getInstance().setUserName(name); + HgConfigFiles.getSysInstance().setUserName(name); } public Boolean isUserNameValid(String name) { - if (userName == null) getUserName(); + if (userName == null) getSysUserName(); if (name.equals(userName)) return true; if (name.length() == 0) return true; return HgMail.isUserNameValid(name); @@ -242,21 +250,28 @@ public class HgModuleConfig { HgConfigFiles hgconfig = new HgConfigFiles(file); String name = hgconfig.getUserName(false); if (name.length() == 0) - name = getUserName(); + name = getSysUserName(); if (name.length() > 0) props.setProperty("username", name); // NOI18N else props.setProperty("username", ""); // NOI18N + name = hgconfig.getDefaultPull(false); + if (name.length() == 0) + name = getSysPullPath(); if (name.length() > 0) props.setProperty("default-pull", name); // NOI18N else props.setProperty("default-pull", ""); // NOI18N + name = hgconfig.getDefaultPush(false); + if (name.length() == 0) + name = getSysPushPath(); if (name.length() > 0) props.setProperty("default-push", name); // NOI18N else props.setProperty("default-push", ""); // NOI18N + return props; } @@ -289,7 +304,7 @@ public class HgModuleConfig { private HgConfigFiles getHgConfigFiles(File file) { if (file == null) { - return HgConfigFiles.getInstance(); + return HgConfigFiles.getSysInstance(); } else { return new HgConfigFiles(file); } diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/config/HgConfigFiles.java --- a/mercurial/src/org/netbeans/modules/mercurial/config/HgConfigFiles.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/config/HgConfigFiles.java Wed Apr 02 11:36:48 2008 +0100 @@ -109,7 +109,7 @@ public class HgConfigFiles { * * @return the HgConfiles instance */ - public static HgConfigFiles getInstance() { + public static HgConfigFiles getSysInstance() { if (instance==null) { instance = new HgConfigFiles(); } @@ -171,8 +171,16 @@ public class HgConfigFiles { setProperty(HG_UI_SECTION, HG_USERNAME, value); } - public String getUserName() { + public String getSysUserName() { return getUserName(true); + } + + public String getSysPushPath() { + return getDefaultPush(true); + } + + public String getSysPullPath() { + return getDefaultPull(true); } public Properties getProperties(String section) { diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/options/MercurialPanel.java --- a/mercurial/src/org/netbeans/modules/mercurial/options/MercurialPanel.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/options/MercurialPanel.java Wed Apr 02 11:36:48 2008 +0100 @@ -249,7 +249,7 @@ final class MercurialPanel extends javax // someCheckBox.setSelected(NbPreferences.forModule(MercurialPanel.class).getBoolean("someFlag", false)); // NOI18N // or: // someTextField.setText(SomeSystemOption.getDefault().getSomeStringProperty()); - initialUserName = HgModuleConfig.getDefault().getUserName(); + initialUserName = HgModuleConfig.getDefault().getSysUserName(); userNameTextField.setText(initialUserName); executablePathTextField.setText(HgModuleConfig.getDefault().getExecutableBinaryPath()); exportFilenameTextField.setText(HgModuleConfig.getDefault().getExportFilename()); diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/ui/pull/Bundle.properties --- a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/Bundle.properties Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/pull/Bundle.properties Wed Apr 02 11:36:48 2008 +0100 @@ -38,8 +38,10 @@ # made subject to such option by the copyright holder. MSG_PULL_PROGRESS = Pulling... -MSG_PULL_FROM = INFO Pull From: {0} - {1} -MSG_PULL_FROM_NONAME = INFO Pull From: {0} +MSG_PULL_FROM = INFO Pulled From: {0} - {1} +MSG_PULLING_FROM = INFO Pulling From: {0} - {1} ... +MSG_PULL_FROM_NONAME = INFO Pulled From: {0} +MSG_PULLING_FROM_NONAME = INFO Pulling From: {0} ... MSG_PULL_TO_NONAME = INFO To: {0} MSG_PULL_TO = INFO To: {0} - {1} MSG_PULL_TITLE = Mercurial Pull diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/pull/PullAction.java Wed Apr 02 11:36:48 2008 +0100 @@ -226,7 +226,15 @@ public class PullAction extends ContextA try { logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_TITLE")); // NOI18N logger.outputInRed(NbBundle.getMessage(PullAction.class, "MSG_PULL_TITLE_SEP")); // NOI18N - + + if (fromPrjName != null) { + logger.outputInRed(NbBundle.getMessage( + PullAction.class, "MSG_PULLING_FROM", fromPrjName, HgUtils.stripDoubleSlash(HgUtils.replaceHttpPassword(pullPath)))); // NOI18N + } else { + logger.outputInRed(NbBundle.getMessage( + PullAction.class, "MSG_PULLING_FROM_NONAME", HgUtils.stripDoubleSlash(HgUtils.replaceHttpPassword(pullPath)))); // NOI18N + } + List listIncoming; if(type == PullType.LOCAL){ listIncoming = HgCommand.doIncoming(root, logger); diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/ui/push/Bundle.properties --- a/mercurial/src/org/netbeans/modules/mercurial/ui/push/Bundle.properties Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/push/Bundle.properties Wed Apr 02 11:36:48 2008 +0100 @@ -38,10 +38,12 @@ # made subject to such option by the copyright holder. MSG_PUSH_PROGRESS = Pushing... -MSG_PUSH_TO = INFO Push To: {0} - {1} +MSG_PUSH_TO = INFO Pushed To: {0} - {1} +MSG_PUSHING_TO = INFO Pushing To: {0} - {1} ... MSG_PUSH_FROM = INFO From: {0} - {1} MSG_PUSH_FROM_NONAME = INFO From: {0} -MSG_PUSH_TO_NONAME = INFO Push To: {0} +MSG_PUSH_TO_NONAME = INFO Pushed To: {0} +MSG_PUSHING_TO_NONAME = INFO Pushing To: {0} ... MSG_PUSH_TITLE = Mercurial Push MSG_PUSH_TITLE_SEP = -------------- MSG_PUSH_DONE = INFO: End of Mercurial Push diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java Wed Apr 02 11:36:48 2008 +0100 @@ -149,16 +149,26 @@ public class PushAction extends ContextA } static void performPush(File root, String pushPath, String fromPrjName, String toPrjName, OutputLogger logger) { try { + File pushFile = new File(pushPath); + boolean bLocalPush = (FileUtil.toFileObject(FileUtil.normalizeFile(pushFile)) != null); + logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_TITLE")); // NOI18N logger.outputInRed(NbBundle.getMessage(PushAction.class, "MSG_PUSH_TITLE_SEP")); // NOI18N + if (toPrjName == null) { + logger.outputInRed( + NbBundle.getMessage(PushAction.class, + "MSG_PUSHING_TO_NONAME", bLocalPush ? HgUtils.stripDoubleSlash(pushPath) : HgUtils.replaceHttpPassword(pushPath))); // NOI18N + } else { + logger.outputInRed( + NbBundle.getMessage(PushAction.class, + "MSG_PUSHING_TO", toPrjName, bLocalPush ? HgUtils.stripDoubleSlash(pushPath) : HgUtils.replaceHttpPassword(pushPath))); // NOI18N + } List listOutgoing = HgCommand.doOutgoing(root, pushPath, logger); if ((listOutgoing == null) || listOutgoing.isEmpty()) { return; } - File pushFile = new File(pushPath); - boolean bLocalPush = (FileUtil.toFileObject(FileUtil.normalizeFile(pushFile)) != null); boolean bNoChanges = HgCommand.isNoChanges(listOutgoing.get(listOutgoing.size() - 1)); if (bLocalPush) { @@ -170,7 +180,7 @@ public class PushAction extends ContextA return; } } - + List list; if (bNoChanges) { list = listOutgoing; diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java --- a/mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/ui/view/ViewAction.java Wed Apr 02 11:36:48 2008 +0100 @@ -107,7 +107,7 @@ public class ViewAction extends ContextA }else if(Utilities.isWindows()){ bHgkFound = HgUtils.isInUserPath(HG_SCRIPTS_DIR + File.separator + hgkCommand); } - boolean bHgkPropExists = HgConfigFiles.getInstance().containsProperty( + boolean bHgkPropExists = HgConfigFiles.getSysInstance().containsProperty( HgConfigFiles.HG_EXTENSIONS, HgConfigFiles.HG_EXTENSIONS_HGK); if(!bHgkFound){ @@ -129,7 +129,7 @@ public class ViewAction extends ContextA if (bConfirmSetHgkProp) { logger.outputInRed( NbBundle.getMessage(ViewAction.class, "MSG_VIEW_SETHGK_PROP_DO_INFO")); // NOI18N - HgConfigFiles.getInstance().setProperty(HgConfigFiles.HG_EXTENSIONS_HGK, ""); // NOI18N + HgConfigFiles.getSysInstance().setProperty(HgConfigFiles.HG_EXTENSIONS_HGK, ""); // NOI18N }else{ logger.outputInRed( NbBundle.getMessage(ViewAction.class, "MSG_VIEW_NOTSETHGK_PROP_INFO")); // NOI18N diff -r 9708b64d41e6 -r 208cabf1e10e mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java --- a/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java Tue Apr 01 20:31:05 2008 +0100 +++ b/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java Wed Apr 02 11:36:48 2008 +0100 @@ -1648,7 +1648,7 @@ public class HgCommand { command.add(repository.getAbsolutePath()); String projectUserName = new HgConfigFiles(repository).getUserName(false); - String globalUsername = HgConfigFiles.getInstance().getUserName(); + String globalUsername = HgConfigFiles.getSysInstance().getSysUserName(); String username = null; if(projectUserName != null && projectUserName.length() > 0) username = projectUserName;