Reset Plastic SCM workspace - plasticscm

Using the command line how can I reset my workspace so that it becomes an exact replica of server version of changeset I'm on? More specifically, how to get rid of all pending changes, all added and removed files, and everything not yet committed to Plastic? Note that cm unco --all does not remove "private" files.

I'm currently using an ugly hack:
FOR /f "tokens=*" %%a in ('cm status --short --private') DO DEL /F /Q "%%a"
cm unco --all --dependencies
Which works okay, however a recent change to cm status causes it to print an extra Finding changed files took too long. Perf tips: https://www.plasticscm.com/download/help/statusperfhintschanged at the end, which throws off the for loop. I haven't found a way to suppress the warning message.

Related

How to set up 1-way sync from Bitbucket Cloud to a local folder

This might sound like a stupid question, and the use-case is rather simple, but I haven't been able to find a decent and simple solution.
In short:
I have a Bitbucket repo that I want to have synced to a local folder on my local server.
So whenever there's an upstream change, the most updated version of the file must be copied to the local folder. There is never a push/commit from local-to-cloud, it's merely a 1-way read-only sync.
Thanks in advance for any suggestions! (maybe the solution is so obvious that I don't see it?)
You don't explain what software is running on your local server, but assuming this is some flavor of UNIX/Linux/macOS and you have crontab access, the easiest thing is probably to just schedule a cron job to pull updates.
A command like the following will schedule a git update every 60 seconds, logging the output to a file:
echo '* * * * * cd $HOME/path/to/git/workdir && git pull -q --ff-only >> update-log 2>&1' | crontab
Note 1: This assumes your user currently has an empty crontab on the server, if you don't then you should instead use crontab -e to manually append the directive to your existing crontab.
Note 2: You'll need to ensure your account on the server has permission to access the BitBucket repo without a tty connection (e.g. without SSH agent forwarding), so you might need to fiddle with authentication to set that up (which is beyond the scope of this answer). For a public BitBucket repo, cloning via HTTPS without a user name is probably the simplest approach, since no authentication is required.
Note 3: The first * in the directive above can be adjusted to select a different polling frequency, e.g. 0,15,30,45 for every 15 minutes. If you omit the 2>&1 then you should get an email for any errors (assuming SMTP is configured on the server).
Note 4: The git command embedded above assumes you never rewrite history in the upstream git repo or manually modify the local directory. If either is a possibility, then you might instead want to use git pull -q --rebase or even git fetch && git reset --hard '#{upstream}'

How do I remove the .exec extension git applies to files?

I messed up so I downloaded an old commit and tried to build from some old code that functioned as intended. I see the files (Podfile, License Gemfile etc) now have a .exec extension and when I push to bitBucket they have a "+x" annotation. When you hover over it says this file is now executable.
Everything still happens to build and run successfully but why does git add this extension to my files without my say so? This issue is causing some concern on my pull request. How do I return my files to being just plainText or whatever they were originally?
I've tried to run chmod -x $(find . -type exec) in the offending directory but this doesn't seem to work.
Anyone know how restore my file to their former purity???
You could:
rename your files
add them again, explicitely removing the 'x' executable bit with git add --chmod=-x aFile
Then you can commit and push again.
But make sure to use Git 2.31 (Q1 2021), because of various fixes on "git add --chmod"(man)".
See commit 9ebd7fe, commit 4896089, commit c937d70 (22 Feb 2021) by Matheus Tavares (matheustavares).
(Merged by Junio C Hamano -- gitster -- in commit f277234, 25 Feb 2021)
add: propagate --chmod errors to exit status
Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau
If add encounters an error while applying the --chmod changes, it prints a message to stderr, but exits with a success code.
This might have been an oversight, as the command does exit with a non-zero code in other situations where it cannot (or refuses to) update all of the requested paths (e.g. when some of the given paths are ignored).
So make the exit behavior more consistent by also propagating --chmod errors to the exit status.
And:
add --chmod: don't update index when --dry-run is used
Helped-by: Junio C Hamano
Signed-off-by: Matheus Tavares
Reviewed-by: Taylor Blau
git add --chmod(man) applies the mode changes even when --dry-run is used.
Fix that and add some tests for this option combination.

How can I run reaction-next-starterkit of reactioncommerce in Windows?

I've been trying to install and run Reaction Commerce with Reaction Plataform using Windows.
I followed all the steps, however after the make command the reaction-next-starterkit doesn't run (I checked using docker ps), and even trying make start it also doesn't work.
I checked the logs with docker-compose logs -f, and the output doesn't show me many things:
': No such file or directory'sh
reaction-next-starterkit_web_1 exited with code 127
And I tried running with other method, like this:
docker-compose up -d - inside the reaction-next-starterkit folder, but also don't keep that running.
I checked all of the containers (including the not running) and I see all of them.
Accordingly to this issue there is a config of Git in Windows that change some files when you make a git clone of any repo, in that specific case it make some projects to break.
So, the solution was to change the specific configuration:
git config --global core.autocrlf input
Then make clean to delete everything made until now, delete the cloned repository, and start from scratch.

How do I get the Flyway version number of a database

I want to pull out the pre-deployment Flyway version number of my production database so I can use this in my continuous deployment pipeline (Jenkins) in case I do a rollback later.
How can I achieve this?
One option would be to query the flyway history table, but I can't work out a fail-safe way of achieving this.
I have fashioned an answer, although it feels like a big of a hack. I run --dryRunOutput in migrate as a means to get flyway to output the version number to the screen, as info doesn't do this for some reason.
I read the output into a file (because DOS makes it hard to pipe or pass into a variable) then isolate the output line starting with "Current". I then pick the second token using : as my delimeter. There's probably an easier way, and I wish I could use flyway info instead of migrate as my method feels hacky, but at least it works for now.
flyway -dryRunOutput=test.sql migrate | FIND "Current" >currentversion.txt
for /f "delims=" %%x in (currentversion.txt) do set CURRENTVERSIONLINE=%%x
for /f "tokens=1,2 delims=:" %%a in ("%CURRENTVERSIONLINE%") do set CURRENTVERSION=%%b
echo Version : %CURRENTVERSION%
The following one-liner does what you want:
flyway info | grep Success | tail -1 | cut -f3 "-d|" | xargs

fatal: Reference has invalid format: 'refs/stash 2' (128)

I am a new solo developer working on my first iOS app. I'm using Git for Mac to backup my progress and it's my first time using Git.
I'm developing the app across 2 laptops.
I also saved my Xcode project in my iCloud folder so that they would be synchronized across both macs.
Everything was working fine for the first 2 months, but I've come across this error on Git for Mac and I can no longer sync to Git nor revert to an older commit.
This is the error:
fatal: Reference has invalid format: 'refs/stash 2' (128)
My guess is that an iCloud synchronization error happened between my macs and that messed up Git.
All I would like to do is be able to fix git so that I can recover my last working commit and then I will remove my project from iCloud to prevent this error from happening again.
Any help you can provide would be greatly appreciated!
View the tree which is under your .git folder:
tree .git and check to see if you actually have this ref in your git filesystem.
If you want to reset your data (if you can) do git reset HEAD --hard it will reset your current branch to the latest commit.
Some other solutions you can try as well
Make a backup of your repository since the following commands are irreversible.
Search for the conflicted files and delete them
find . -type f -name "* conflicted copy*" -exec rm -f {} \;
lastly, remove any "conflicted" references from git's packed-refs file
awk '!/conflicted/' .git/packed-refs > temp && mv temp .git/packed-refs
Also take a look here (where the conflicts file may be in):
.git/logs/refs/remotes/origin/
.git/logs/refs/heads/
.git/refs/remotes/origin/
.git/refs/heads/
Hope it will help you fix the problem.

Resources