Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 125013 - Push command should not use -f by default
Push command should not use -f by default
Status: VERIFIED FIXED
Product: versioncontrol
Classification: Unclassified
Component: Mercurial
6.x
All All
: P3 (vote)
: 6.x
Assigned To: issues@versioncontrol
issues@versioncontrol
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-10 08:44 UTC by Jiri Skrivanek
Modified: 2008-01-21 19:41 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Proposed patch (11.02 KB, text/plain)
2008-01-11 15:19 UTC, John Rice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2008-01-10 08:44:10 UTC
If you run Push command in Mercurial plugin it silently does 'hg push -f'. It leads to unwanted heads in target
repository. IDE should use just 'hg push' to force user to merge before push.

versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java#doPush

Mercurial Pluging: 1.4.3.42.1
Mercurial Runtime: 0.9.5
Product Version: NetBeans IDE Dev (Build 20080107122025)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)
Comment 1 John Rice 2008-01-11 15:18:20 UTC
Will do a Push without -f by default and if it fails as new branches would be created in the target repo, warn the user
and give them the option to do a forced push if the really want to.
Comment 2 John Rice 2008-01-11 15:19:08 UTC
Created attachment 54953 [details]
Proposed patch
Comment 3 John Rice 2008-01-11 15:21:51 UTC
IDE:-------------------------------------------------
IDE: [11/01/08 15:21] Committing started
Checking in ui/push/PushAction.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java,v  <--
 PushAction.java
new revision: 1.19; previous revision: 1.18
done
Please verify that this works against your remote repository - I've checked it locally.

Checking in ui/push/Bundle.properties;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/push/Bundle.properties,v 
<--  Bundle.properties
new revision: 1.12; previous revision: 1.11
done
Checking in util/HgCommand.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java,v  <-- 
HgCommand.java
new revision: 1.65; previous revision: 1.64
done
IDE: [11/01/08 15:21] Committing finished
Comment 4 Jesse Glick 2008-01-11 18:16:43 UTC
If new branches would be created in the target repo, the correct response is not to push -f! You should pull -u, merge,
commit, push again.
Comment 5 John Rice 2008-01-11 19:13:50 UTC
Why? If I am doing a push to a repo I am working with and I want to create the new branch then surely that's my choice. 
We inform the user what will happen and let them make the call. If they don't want to brnach, cancel and then go and do
a Pull. Otherwise continue with the Push.

That's why the dialog warns users and asks them if they had forgotten to sync and merge first, giving them the option to
cancel.

If we don't give them the option then I can't push back to the repo and branch it if I wish to.
Comment 6 Jesse Glick 2008-01-11 21:36:02 UTC
Generally you do not want to create a new head in the public repository as this simply forces someone else to do your
merge for you. (For NB repositories we may well enforce this with a server hook rejecting any set of changesets which
introduces an extra head.) If you really wanted a new branch, you probably meant to create a separate clone.

It is better than nothing to inform people with a dialog box that they need to pull, but what a GUI should really do is
ask for permission and then go ahead and pull and merge and retry the push. It should certainly not encourage a push -f
or make it seem easier than the correct alternative. IMHO a GUI should not offer push -f as an option at all; if you
really know what you are doing and are sure you want to do it, you can always push -f from the command-line.
Comment 7 John Rice 2008-01-15 13:43:55 UTC
OK - removed ability to do the forced push, now simply warn user that resync is required and they need to do a Pull
followed by a Merge, before redoing the Push.

I have not added an option to do the Pull and Merge automatically, if you want this then just raise an RFE, but it's
pretty easy for the user to do it themselves, using the available menus.

IDE:-------------------------------------------------
IDE: [15/01/08 13:39] Committing started
Checking in PushAction.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/push/PushAction.java,v  <--
 PushAction.java
new revision: 1.20; previous revision: 1.19
done
Checking in Bundle.properties;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/push/Bundle.properties,v 
<--  Bundle.properties
new revision: 1.13; previous revision: 1.12
done
IDE: [15/01/08 13:39] Committing finished
IDE: [15/01/08 13:39] Diffing finished
Comment 8 Jiri Skrivanek 2008-01-17 17:34:03 UTC
Verified.
Comment 9 Jesse Glick 2008-01-21 19:41:55 UTC
See issue #125704 for pull-and-merge ("fetch") combo.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo