VCS resets to git after syncing

Answered

Been trying to figure out what would cause this but im seeing an issue when Syncing to the head of the branch using perforce.

 

Currently my vcs.xml looks like

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Perforce" />
<mapping directory="$PROJECT_DIR$" vcs="Perforce" />
</component>
</project>

If I leave Intellij open, Sync the code and run dist-clean (or just a clean), let Intellij reindex the changes, all of a sudden it loses my VCS settings changing the VCS to Git instead of Perforce. This however does not happen if I close intellij and sync and clean so im thinking there has to be something happening during the reindex where it is resetting my settings.

 

Incase it helps, we do have the perforce repository under a git project.

 

Let me know what I can try to get this to keep my settings.

9 comments
Comment actions Permalink

Do you have the vcs.xml tracked by perforce?

Is it changed when you do p4 clean?

Also the mapping you have is excessive - you have both <Project> and exact project path mapped to Perofrce.

I would recommend to delete the <Project> mapping, this line:

<mapping directory="" vcs="Perforce" />
0
Comment actions Permalink

Hey Dmitriy,

It is currently marked for add on my local workspace but not checked into the branch. Ill try p4 clean later but I don't think that is the problem as the issue only arrises when intellij is left open.

Yeah I know its redundant, I was trying a bunch of things to figure out if any of the settings would be maintained. Ill remove it befor eI sync later.

I also just added #com.intellij.vcsUtil.VcsUtil to custom debug level to see if I cant get any additional logs that would point at the issue. Do you know of any additional loggers I should add?

 

Thanks again!

0
Comment actions Permalink

I actually can't reproduce the behaviour using p4 sync - p4 clean commands with IDEA opened.

AFAIK p4 clean command deletes from workspace all files that are not present in depot, so since VCS.xml is not checked in, it might affect.

You can try adding the following debug categories to get more details:

  1. #git4idea (to see if git integration is involved)
  2. #org.jetbrains.idea.perforce
  3. #com.intellij.openapi.vcs

And btw, is there .git folder present in the project directory somehow?

0
Comment actions Permalink

Thanks Ill add those as well

Just looked at if there is a git folder in the repository, turns out there is, the build wrapper we have in place addes this into the branch even though its not used (there are some static files that are managed by the build wrapper which is where the git folder comes)

That is probably why its reseting to git however ideally the settings should not be updated if they are already set.

 

Ill get back once I sync and see if there are any log lines, im somewhat expecting to receive a log about updating existing project.

0
Comment actions Permalink

So after syncing it happened again. Now my VCS.xml looks like 

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="" vcs="Perforce" />
    <mapping directory="$PROJECT_DIR$/.." vcs="Perforce" />
    <mapping directory="$PROJECT_DIR$" vcs="Git" />
  </component>
</project>

 

Managed to grab some logs from those loggers:

 

Right here is when it is querying perforce so the project is still registered as perforce. 

2016-07-21 18:14:33,791 [273235637] DEBUG - nges.UpdatingChangeListBuilder - processUnversionedFile file:///Users/home/app/main/.last_checked_sync 
2016-07-21 18:14:33,806 [273235652] DEBUG - .changes.ChangeListManagerImpl - refresh procedure finished, unversioned size: 27
changes: ChangeListWorker{myMap=list: Default changes:
list: %% LIST OF LOCAL P4 CHANGES REMOVED BY BRIAN%%
2016-07-21 18:14:33,821 [273235667] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 0
2016-07-21 18:14:33,821 [273235667] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 1
2016-07-21 18:14:33,821 [273235667] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: invokeD, project: SFDC-main, runnable: 904607183
2016-07-21 18:14:33,821 [273235667] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: delete executed, project: SFDC-main, runnable: 904607183
2016-07-21 18:14:33,821 [273235667] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: Runnables executed, project: SFDC-main, runnable: 904607183
2016-07-21 18:14:33,821 [273235667] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: INVOKE, project: SFDC-main, runnable: 89950218
2016-07-21 18:14:33,822 [273235668] DEBUG - .changes.ChangeListManagerImpl - refresh procedure started, everything: false dirty scope: VcsDirtyScope[
dirs: /Users/home/app/main/core/sos/target/
affected roots: /Users/home/app/main/core
affected roots with check: /Users/home/app/main/core ]
current changes: ChangeListWorker{myMap=list: Default changes:
list: %% LIST OF LOCAL P4 CHANGES REMOVED BY BRIAN%%
2016-07-21 18:14:33,822 [273235668] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 1
2016-07-21 18:14:33,858 [273235704] DEBUG - #git4idea.commands.GitHandler - [core] git -c core.quotepath=false status --porcelain -z --untracked-files=no -- sos/target
2016-07-21 18:14:33,905 [273235751] DEBUG - #git4idea.commands.GitHandler -
2016-07-21 18:14:33,906 [273235752] INFO - .status.GitNewChangesCollector - GitRepository is null for root file:///Users/home/app/main/core
2016-07-21 18:14:33,906 [273235752] DEBUG - #git4idea.commands.GitHandler - [core] git -c core.quotepath=false rev-list --timestamp --max-count=1 HEAD --
2016-07-21 18:14:33,931 [273235777] DEBUG - #git4idea.commands.GitHandler -
2016-07-21 18:14:33,932 [273235778] DEBUG - #git4idea.commands.GitHandler - [core] git -c core.quotepath=false ls-files --exclude-standard --others -z --
2016-07-21 18:14:33,952 [273235798] DEBUG - #git4idea.commands.GitHandler -
2016-07-21 18:14:33,953 [273235799] DEBUG - .changes.ChangeListManagerImpl - refresh procedure finished, unversioned size: 27
changes: ChangeListWorker{myMap=list: Default changes:
list: %% LIST OF LOCAL P4 CHANGES REMOVED BY BRIAN%%
2016-07-21 18:14:33,953 [273235799] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 1
2016-07-21 18:14:33,953 [273235799] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 1
2016-07-21 18:14:33,953 [273235799] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: invokeD, project: SFDC-main, runnable: 89950218
2016-07-21 18:14:33,953 [273235799] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: delete executed, project: SFDC-main, runnable: 89950218
2016-07-21 18:14:33,953 [273235799] DEBUG - cs.changes.UpdateRequestsQueue - MyRunnable: Runnables executed, project: SFDC-main, runnable: 89950218
2016-07-21 18:14:33,953 [273235799] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 1
2016-07-21 18:14:33,954 [273235800] DEBUG - vcs.changes.ChangesViewManager - schedule refresh, was 1
2016-07-21 18:14:34,537 [273236383] DEBUG - vcs.changes.ChangesViewManager - refresh view, unversioned collections size: 27 unv size passed: 27 dirs:

 

Now it seems to modify the vcs file

2016-07-21 18:14:49,470 [273251316] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.sos.iml.sha 
2016-07-21 18:14:49,490 [273251336] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.sos.iml.sha
2016-07-21 18:14:49,490 [273251336] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.project
2016-07-21 18:14:49,490 [273251336] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.project
2016-07-21 18:14:49,491 [273251337] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/sos.iml
2016-07-21 18:14:49,491 [273251337] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/sos.iml
2016-07-21 18:14:49,493 [273251339] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.settings
2016-07-21 18:14:49,493 [273251339] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.settings
2016-07-21 18:14:49,496 [273251342] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.classpath
2016-07-21 18:14:49,497 [273251343] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/sos/.classpath
2016-07-21 18:14:49,497 [273251343] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/.idea/.vcs.xml.swp
2016-07-21 18:14:49,498 [273251344] DEBUG - lij.openapi.vcs.VcsVFSListener - fileCreated: /Users/home/app/main/core/.idea/.vcs.xml.swp
2016-07-21 18:14:49,830 [273251676] DEBUG - anges.VcsDirtyScopeManagerImpl - dirty files: Git: /Users/home/app/main/core/.idea/.vcs.xml.swp


Now the project is configured under git.

2016-07-21 18:13:59,594 [273201440] DEBUG - #git4idea.commands.GitHandler - [core] git -c core.quotepath=false status --porcelain -z --untracked-files=no -- . 

2016-07-21 18:13:59,701 [273201547] INFO - .status.GitNewChangesCollector - GitRepository is null for root file:///Users/home/app/main/core
2016-07-21 18:13:59,702 [273201548] DEBUG - #git4idea.commands.GitHandler - [core] git -c core.quotepath=false rev-list --timestamp --max-count=1 HEAD --
2016-07-21 18:13:59,725 [273201571] DEBUG - #git4idea.commands.GitHandler -
2016-07-21 18:13:59,725 [273201571] DEBUG - #git4idea.commands.GitHandler - [core] git -c core.quotepath=false ls-files --exclude-standard --others -z --
2016-07-21 18:13:59,752 [273201598] DEBUG - #git4idea.commands.GitHandler -


 

Thanks for your help so far, let me know what you get from those logs.

 

0
Comment actions Permalink

vcs.xml should not be recreated during normal operation.

Since IDEA recreates this, it seems like p4 sync or clean operation deletes the file or somehow changes it.

Try excluding vcs.xml from version control at all, by adding it to p4ignore.

0
Comment actions Permalink

Hey Dmitriy,

I can confirm this issue has nothing to do with p4. I checked the vcs.xml file every stage of syncing and nothing changed between pre and post sync. The changes only occurred once I returned focus to Intellij and the indexing begin. You can also confirm this in the logs: 

at 2016-07-21 18:14:33,79 it was registered as perforce, however seconds later at 2016-07-21 18:14:49,497 it appears to be creating a swap file for the vcs in what I can only believe is it modifying the file.

0
Comment actions Permalink

Brian,

Please submit a bug at https://youtrack.jetbrains.com/issues/IDEA

and attach full IDEA.log for further troubleshooting.

Thank you.

0

Please sign in to leave a comment.