This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 126414 - Cannot refactor/rename unmanaged files
Summary: Cannot refactor/rename unmanaged files
Status: RESOLVED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@versioncontrol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-31 17:01 UTC by _ tboudreau
Modified: 2008-02-13 11:01 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch (3.38 KB, patch)
2008-02-13 09:29 UTC, Padraig Obriain
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2008-01-31 17:01:44 UTC
Filing this separately as requested in issue 126062.  Exact steps to reproduce (but check out http://netbeans.ath.cx quickly as it's a temporary server):

hg clone https://netbeans.ath.cx
Open the project $CHECKOUT_ROOT/epbuild/anttasks
Select the class ForEachToken.java
Copy and paste it into the same package

You get some logging, but it works

ERROR Command failed:
Command: [/usr/local/bin/hg, rename, --repository, /Users/tim/ext, --cwd, /Users/tim/ext, 
epbuild/anttasks/src/org/netbeans/ant/ForEachToken_1.java, epbuild/anttasks/src/org/netbeans/ant/ForEachToken1.java]
Output: [epbuild/anttasks/src/org/netbeans/ant/ForEachToken_1.java: not copying - file is not managed, abort: no files to copy]

Select it, right-click and choose Refactor/Rename

Some more logging in the output window:
ERROR Command failed:
Command: [/usr/local/bin/hg, rename, --repository, /Users/tim/ext, --cwd, /Users/tim/ext, 
epbuild/anttasks/src/org/netbeans/ant/ForEachToken_1.java, epbuild/anttasks/src/org/netbeans/ant/ForEachToken1.java]
Output: [epbuild/anttasks/src/org/netbeans/ant/ForEachToken_1.java: not copying - file is not managed, abort: no files to copy]
ERROR Command failed:
Command: [/usr/local/bin/hg, rename, --repository, /Users/tim/ext, --cwd, /Users/tim/ext, 
epbuild/anttasks/src/org/netbeans/ant/ForEachToken_1.java, epbuild/anttasks/src/org/netbeans/ant/Foo.java]
Output: [epbuild/anttasks/src/org/netbeans/ant/ForEachToken_1.java: not copying - file is not managed, abort: no files to copy]

And the java class inside the file is renamed but the source is not.

Same problem if I create a new .properties file - i.e. it has nothing to do with refactoring.
Comment 1 _ tboudreau 2008-01-31 17:03:58 UTC
Also:  After deleting ForEachToken_1.java, it remained open in the editor - the FileObject did not fire any change that it was invalid.  In fact if you make a 
change and save it, it appears again.
Comment 2 Padraig Obriain 2008-02-01 11:11:54 UTC
I can reproduce this doing Paste | Refactor Copy ...
Comment 3 Padraig Obriain 2008-02-01 13:35:48 UTC
It looks like the problem is with ignored rather than unmanaged files.

Part of the fix I have just made for #126385 fixes the first problem you reported.

Are the other problems fixed?

I cannot reproduce them.
Comment 4 _ tboudreau 2008-02-01 21:42:40 UTC
Well, if you notice, in the IDE, ForEachToken.java is always annotated as ignored even though it is not.  Some bug in the way we parse globs in .hgignore?
Comment 5 Peter Pis 2008-02-05 08:40:08 UTC
I've tried:
1. Create new class (A.java) in project under Hg control.
2. "Mercurial | Ignore" action on "A.java".
3. "Refactor | Rename" action on "A.java" to "B.java".
4. "B.java" is [Locally New]
5. "Refactor | Rename" action on "B.java" to "A.java".
6. "A.java" is ignored.

Can't it be your case?
Comment 6 Padraig Obriain 2008-02-07 15:41:59 UTC
When I try to follow Peter's instructions I get

java.lang.NoClassDefFoundError: org/netbeans/modules/j2ee/core/api/support/java/JavaIdentifiers
        at org.netbeans.modules.j2ee.jpa.refactoring.PersistenceXmlRefactoring.prepare(PersistenceXmlRefactoring.java:253)
        at org.netbeans.modules.j2ee.jpa.refactoring.JPARefactoringPlugin.prepare(JPARefactoringPlugin.java:89)
[catch] at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare(AbstractRefactoring.java:380)
        at org.netbeans.modules.refactoring.api.AbstractRefactoring.prepare(AbstractRefactoring.java:202)
        at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$Prepare.run(ParametersPanel.java:765)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)

Regarding Tim's last comment, I do see that the src directory is ignored. I will try to figure out why.
Comment 7 Padraig Obriain 2008-02-07 16:26:27 UTC
epbuild/anttasks/src matches build/

Is this a problem with .hgignore file?

Should this be /build/
Comment 8 Padraig Obriain 2008-02-13 08:42:59 UTC
The problem seems to be that files which are managed are being reported as ignored.
Comment 9 Padraig Obriain 2008-02-13 09:29:32 UTC
Created attachment 56577 [details]
proposed patch
Comment 10 Padraig Obriain 2008-02-13 11:01:48 UTC
changeset:   67113:3604215eb339
user:        padraigob@netbeans.org
date:        Wed Feb 13 10:55:22 2008 +0000
files:       mercurial/src/org/netbeans/modules/mercurial/FileStatusCache.java
mercurial/src/org/netbeans/modules/mercurial/util/HgCommand.java
description:
126414: Do not report managed files as ignored.
Change createFileInformation to only call HgUtils.isIgnored if hg status is not being called.
Undo  change for #124323 in HgCommand.getSingleStatus


changeset:   67214:80e4cd9a91f7
tag:         tip
parent:      67113:3604215eb339
parent:      67213:12dd916e0485
user:        padraigob@netbeans.org
date:        Wed Feb 13 10:59:05 2008 +0000
files:       websvc.saas.api/build/classes/org/netbeans/modules/websvc/saas/Bundle.properties
websvc.saas.api/build/classes/org/netbeans/modules/websvc/saas/resources/layer.xml
websvc.saas.api/src/org/netbeans/modules/websvc/saas/resources/layer.xml
websvc.saas.ui/src/org/netbeans/modules/websvc/saas/ui/nodes/WadlSaasMethodNode.java
description:
Automated merge with http://hg.netbeans.org/main