Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Delete and recreate file under vcs
Delete and recreate file under vcs [message #719714] Sun, 28 August 2011 15:09 Go to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi everybody,

please correct me if I ask this question in the wrong newsgroup.

I'm developing a code generator that is triggered by an Eclipse builder.
According to the general contract of an Eclipse builder, every produced
artifacts and internal state should be removed / cleared on a clean
build. That is, the generated files will be deleted. When they have been
put under version control, the move delete hook will kick in and mark
the file as removed e.g. for git, cvs, clearcase or subversion. So far
so good.

The problem is a subsequent build which will recreate files with the
very same names. What I'd like to happen is, that the remove-markers for
the VCS are reverted because the file is back in place (and it's likely
that it has the same content). I've looked into the team API but
couldn't find a proper mechanism that allows to identify this situation
(agnostic to the concrete VCS) and perform the necessary steps in order
to restore the meta data et.al.
Can you please point me into the right direction for my use case (and
yes, I'm aware of the fact that generated artifacts shouldn't be put
under VCS but life isn't always as it should be ;-) )?

Thanks in advance,
Sebastian
Re: Delete and recreate file under vcs [message #719920 is a reply to message #719714] Mon, 29 August 2011 13:13 Go to previous messageGo to next message
John Arthorne is currently offline John ArthorneFriend
Messages: 176
Registered: July 2009
Senior Member
> What I'd like to happen is, that the remove-markers for
> the VCS are reverted because the file is back in place

This should happen automatically when the file is recreated. A "remove-marker" is a special kind of resource called a phantom. If a resource with the same name is created it replaces the phantom, so there is no longer a record of a removal anywhere. A VCS system might still interpret this as an outgoing change depending on how it does that calculation (timestamp, content hash, etc).

> a proper mechanism that allows to identify this situation (agnostic to the
> concrete VCS) and perform the necessary steps in order to restore the meta data

What metadata are you referring to here? Most metadata such as markers and properties are permanently deleted when the resource is deleted. There is no way to restore such data when the resource is recreated. Some other data such as local history is stored against the project, so as long as the project wasn't deleted that information should still be intact. Either way there is nothing special for you to do here other than creating the resource and providing its new contents.

Hope that helps,
John
Re: Delete and recreate file under vcs [message #720109 is a reply to message #719920] Mon, 29 August 2011 22:15 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi John,

thanks for your answer. With metadata I was refering especially to SVN
specific information in the .svn folder.
However, if I understood you correctly, the Team provider should take
care of removing the delete-marker for a file as soon as I gets
recreated and there is no general API in Eclipse that allows to enforce
this. If it turns out, that e.g. some SVN integration plugin doesn't
play well with this, I could either provide an implementation specific
for that plugin or try to file a bug there. Probably not too promising
when it comes to clearcase or other commercial VCS :-)

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 29.08.11 15:13, John Arthorne wrote:
>> What I'd like to happen is, that the remove-markers for
>> the VCS are reverted because the file is back in place
>
> This should happen automatically when the file is recreated. A
> "remove-marker" is a special kind of resource called a phantom. If a
> resource with the same name is created it replaces the phantom, so there
> is no longer a record of a removal anywhere. A VCS system might still
> interpret this as an outgoing change depending on how it does that
> calculation (timestamp, content hash, etc).
>
>> a proper mechanism that allows to identify this situation (agnostic to
>> the concrete VCS) and perform the necessary steps in order to restore
>> the meta data
>
> What metadata are you referring to here? Most metadata such as markers
> and properties are permanently deleted when the resource is deleted.
> There is no way to restore such data when the resource is recreated.
> Some other data such as local history is stored against the project, so
> as long as the project wasn't deleted that information should still be
> intact. Either way there is nothing special for you to do here other
> than creating the resource and providing its new contents.
>
> Hope that helps,
> John
Previous Topic:Different Action name depending on the OS (Operation System)
Next Topic:Release build confusion: How to identify?
Goto Forum:
  


Current Time: Fri Apr 19 21:15:10 GMT 2024

Powered by FUDForum. Page generated in 0.03417 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top