DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Integration Architecture Guiding Principles, A Reference
  • A Data-Driven Approach to Application Modernization
  • What I Learned From Crawling 100+ Websites
  • Fun Is the Glue That Makes Everything Stick, Also the OCP
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. IntelliJ IDEA's Perforce Integration Lets Work Offline

IntelliJ IDEA's Perforce Integration Lets Work Offline

Irina Megorskaya user avatar by
Irina Megorskaya
·
Apr. 08, 08 · News
Like (0)
Save
Tweet
Share
10.81K Views

Join the DZone community and get the full member experience.

Join For Free

Consider a rather typical case, when connection to your Perforce server breaks down just in the middle of editing... Or you want to speed up your work, avoiding unnecessary calls to the server… What will you do with the files in your local working copy – can you edit, delete or create them? What happens, if you terminate your IntelliJ IDEA session while offline? Let’s see how IntelliJ IDEA helps resolve these situations.

You can continue your regular activities with the files under Perforce version control regardless of the connection state, using offline mode. When the Perforce integration is in offline mode, IntelliJ IDEA keeps the log of changes in the *.iws file of your project. The entries in this log are preserved, when you restart IntelliJ IDEA.

In offline mode you can edit, create, copy, rename or move files, revert changes, view cached information in the Incoming and Repository tabs, create or delete changelists and move changes between them. All these changes are replayed when you return to online mode. While offline, you cannot perform the operations that require immediate connection to the server, which includes update, commit, integrate etc.

You can enter the offline mode in two ways. First, if connection to the server is lost, IntelliJ IDEA suggests you to continue your work offline. The other way lies with choosing offline mode on the Version Control menu (Version Control | Perforce | Work Offline)

[img_assist|nid=2298|title=|desc=|link=none|align=left|width=388|height=221]

 

 

 

 

 

 

 

 

In both cases, the result is the same - any changes in your local working copy that do not require server connection, go to changelist and are displayed in the Local tab of the Changes tool window. When you are back in online mode, you can commit the changes made while offline.

Now, let us consider an example, when in offline mode, you edit an existing file, and create a new file. First, let’s change color in a CSS file: press Ctrl+Space, and choose color from the suggestion list:

[img_assist|nid=2299|title=|desc=|link=none|align=left|width=294|height=128]

 

 

 

 

 

Note the change marker that appears in the left gutter of the editor: as in all files under version control, the changes are color-coded: the blue stripe is for the changed lines, grey triangle - for deleted lines, and the green stripe – for added lines.

The modified file is immediately added to the Default changelist. You can easily recognize the offline mode by the disabled Commit Changes icon:

[img_assist|nid=2300|title=|desc=|link=none|align=left|width=212|height=70]

 

 

 

Now, create a new class in the src directory (in the Project view, right-click the directory and choose New | Class on the context menu):

[img_assist|nid=2301|title=|desc=|link=none|align=left|width=434|height=151]

 

 

 

 

 

 

IntelliJ IDEA prompts you to put the new class under version control, or do it later. If you choose to put a new class under version control, it is immediately added to the Default changelist. If you choose to leave the new file unversioned, it does not appear in the Changes tool window at all, but when you return online, you will see the new changelist named “Unversioned Files” with the class added in offline mode:

[img_assist|nid=2302|title=|desc=|link=none|align=left|width=282|height=97]

 

 

 

 

Enjoy!

intellij Integration

Opinions expressed by DZone contributors are their own.

Trending

  • Integration Architecture Guiding Principles, A Reference
  • A Data-Driven Approach to Application Modernization
  • What I Learned From Crawling 100+ Websites
  • Fun Is the Glue That Makes Everything Stick, Also the OCP

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: