Jump to content

Cannot cherry pick/partially revert file adds and deletions?


Wolfram

Recommended Posts

Hiho.

According to the branch-per-task paradigm "check in everything on 'your' branch, often, even if it's unfinished or doesn't currently compile", let's say I created a changeset "x" where I changed, added, and deleted a few files.

Now let's say the next day I noticed it was a mistake to delete these file. So I want to revert that part - but keep the other changes, and keep the added files! I was unable to find a (manageable or even clean) way to do this:

- It seems I cannot cherry-pick from a previous changeset of the same branch (=from a poisition where the deleted files still existed), as it always says "merge destination already contains source changes" (EDIT: I just noticed the option "Ignore merge tracking" which seems to help there, but it doesn't fix the actual problem described below.

- Creating two new branches from cs:x and cs:x-1, and then trying to cherry pick between these results in the same thing:  "merge destination already contains source changes". (EDIT: furthermore, with "Ignore merge tracking", it now doesn't show ANY differences (="No items to merge have been detected"), so it's worse than the above attempt)

- Then I started experimenting with a subtractive merge, and somehow combining this and one of the branches again - but I always ran into the same problem.

The actual problem: In the cherry pick/merge window there is a "Contributor" column, where I can pre-select which version I want to keep. However, it's only possible to influence this for *changes* - it's always empty and cannot be changed for both file additions and deletions (the context menu is still active, but making a different selection there is ignored). It's unclear to me WHY, as it prevents cherry-picking of adds/deletes. Is that a bug or am I missing something?

 

I did find a workaround that actually accomplished the partial revert: using shelves. Create branch from cs:x-1, merge from cs:x, shelf the changes, go back to the original branch cs:x, apply shelf, discard the deletes.

This looks messy, as it circumvents the branch explorer diagram (=no arrows, no connections), and it leaves a dangling/dead end branch. Also, it contradicts the concept of "commit everything", if it's such a hassle to recover from it.

 

So my actual question: What is the best/cleanest way to partial revert such a delete?

Thanks for any help! :-)

Link to comment
Share on other sites

Hi!

the easiest way is using the "cm undelete" command:

cm undelete serverpath:/Script.sh#cs:2537 Script.sh

The command above will restore the item "Script.sh" that was loaded in the changeset #2537. This option is only having GUI support for Gluon, it's in out roadmap to support it at plastic, macplastic and gtkplastic.

Link to comment
Share on other sites

  • 2 weeks later...
On 11/15/2016 at 5:51 PM, manu said:

Hi!

the easiest way is using the "cm undelete" command:


cm undelete serverpath:/Script.sh#cs:2537 Script.sh

The command above will restore the item "Script.sh" that was loaded in the changeset #2537. This option is only having GUI support for Gluon, it's in out roadmap to support it at plastic, macplastic and gtkplastic.

Thank you for your response. However, I am unable to get this to work. Wnat exactly is the syntax for "serverpath"? I couldn't find a documentation for this.

I tried several variants, and I always get either "Incorrect object specification [...]" or "Error: The given path's format is not supported.". What I tried:

- cm undelete /ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete \ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete ssl://our.server.url:8088:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete our.server.url:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- and by now most combinations of that with the "ssl" and/or "8088" segment present or missing

(NOTE: cs:7 is the last cs that still contained the file - is that the one I need to reference?)

Link to comment
Share on other sites

Hi!

it would be something like:

Quote

cm undelete serverpath:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

Assuming "ScriptDontKeep.cs" was directly placed at the root directory path when it was living at the changeset #7.

You need to execute the command inside the Plastic SCM workspace.

Link to comment
Share on other sites

On 11/29/2016 at 0:53 PM, manu said:

Hi!

it would be something like:

cm undelete serverpath:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

Assuming "ScriptDontKeep.cs" was directly placed at the root directory path when it was living at the changeset #7.

You need to execute the command inside the Plastic SCM workspace.

I get the general syntax of this command. I assume the problem lies in the specification of "serverpath": Can you give me a concrete example of specifying an url path to an ssl server? I still get the error "Error: The given path's format is not supported." for ALL the following combinations:

- cm undelete our.server.url:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete our.server.url:8088:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete ssl://our.server.url:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete ssl://our.server.url:8088:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete serverhostname:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs

- cm undelete 1.2.3.4:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs (=the IP of the server)

I am in the Workspace root, the file was located in the Workspace root, the file is not listed in cs:7 (as it was not modified there), it was added before cs:7, and deleted in cs:9.

Link to comment
Share on other sites

I'm sorry, I think I didn't explain it in detail, you need to execute the following:

cm undelete serverpath:/ScriptDontKeep.cs#cs:7 ScripDontKeep.cs 

as it is, don't replace "serverpath", it's a reserved word for this command. Sorry about the misunderstanding.

Link to comment
Share on other sites

D'oh... x-D that is a rather unconventional specifiation... :-/

It worked now!

Is there an online documentation for this command? It's not included in the "PLASTIC SCM CLI GUIDE" at https://www.plasticscm.com/documentation/cli/plastic-scm-version-control-cli-guide.shtml . I realize it's somewhat documented in the CLI interface itself via "cm help", but you first have to fifgure out it actually exists, and/or figure out the correct parameter for "cm showcommands" to have it listed.

 

Also:

I stumbled upon a very old thread where I learned I CAN actually do what I want via the (Windows-)client: In the Item history, there is a "Revert to this revision" in the context menu. But it is very well hidden: It's shown ONLY in the "View History" of that item (not even possible in the "View History as 2D tree"), so in the case of the file being delete, I first have to "Browse the repository" of a cs that still has the item in it, *then* select the item, *then* view its history, *then* revert...

Although complicated, isn't that a "cleaner" way to undelete/revert a file?

Also, in case of deleted files, is there an actual difference in the result of "cm undelete" vs. "cm revert"?

 

Link to comment
Share on other sites

Hi,

Happy to know it's working! :)

the command is documented with examples, you can review them by running "cm undelete --help". You can get all the Plastic SCM commands running the "cm showcommands --all" command.

Regarding the "revert" command, it's similar to the "undelete" command,  both command will recover a certain revision and will place it in your workspace, then the ci command will generate a new changeset, a new tree, loading the reverted revision. What sounds weird to me is the fact that you can use the revert command in order to restore deleted revision, it doesn't work for me. I'm doing the following:

1) Create a new file and check it in, cset #1

2) Create a new revision for the file, cset #2 created.

3) Delete the file, cset #3 created.

Now if I browse the tree for the cset #2 and open the revision history I have the option for reverting it to the first or the second revision, it doesn't matter which one I choose, the result is nothing.

 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...