How to save changes to a working copy of SVN in a zip file

I use svn and sometimes I need to undo some changes that do not go well. First, I would like to zip the modified files. I would like zip to have full paths. I use TortoiseSVN for the most part, but I'm not afraid to use the command line if necessary.

+5
source share
10 answers

OK. I found one way to do this, but I'm not very happy with that. I answer my question, but I hope someone can improve it.

  • Use WinZip to create an empty zip file with . Include full path information. Leave zip open in WinZip. I was not able to figure out how to do this using my own zip utility for Windows.
  • In a working copy, use the TourtoiseSVN context menu to open the Check for Modifications dialog box.
  • Select all the files in the dialog box and drag them and run them in WinZip.
0
source

You can simply use simple single-line bash (assuming you are a happy Linux user):

zip ~/modified.zip $(svn status | grep ^M | awk '{ print $2;}')

It extracts all files with M status so Modified.

+6
source

In the TourtoiseSVN Check for Modifications dialog box

  • select the files you need.
  • right click
  • then shell context menu to send them to 7zip
+4
source

You can buy a copy of WinZip or use open-source 7-Zip . Both have command line versions that will do what you want. Both of them also support the use of the Windows shell as extensions, that is, you can select one or more files from Windows Explorer, right-click and execute the compression settings from the context menu. (Or better than using the drag and drop solution you submitted, BTW.)

Both products contain pretty good documentation on how to use them from the command line, if you choose this option.

With support for 7-Zip support, you Shift + Click or Ctrl + Click to select files, then right-click any of them and select 7-Zip->Add to archive... in the context menu. You can then check this option to specify path information.

WinZip contains similar functionality from the Windows shell, although I have not used it for many years and cannot give specific instructions.

+3
source

This is rude, but it works.

 @echo ================================================ @echo ZIPS all modified or added svn controlled files @echo to the specified zip file @echo "svnzipmodified <filename>" @echo ================================================ @if "%1"=="" goto end @echo Getting list of modified or added files @echo ================================================ svn status -q > list.txt @echo Strip status text to leave path and filename @echo ================================================ find "M " list.txt > list2.txt find "A " list.txt >> list2.txt (for /F "tokens=1,2*" %%i in (list2.txt) do @echo %%j) > list3.txt @echo Zip up files @echo ================================================ del %1 /Q "C:\Program Files\MATLAB\R2010a\bin\win64\zip.exe" %1 -@ < list3.txt pause del list3.txt /Q del list2.txt /Q del list.txt /Q @echo Done @echo ================================================ :end 
+3
source

You can save your local changes to a file using

 svn diff > my_changes.patch 

These changes can be restored later:

 patch -p0 < my_changes.patch 
+1
source

I like this solution because it works on Windows and Mac with a few changes.

Download the subversion command line client. On Windows, check SlikSVN at http://sliksvn.com/en/download/ as TortoiseSVN does not provide it.

Download Python 3.x if you don't have one.

Download 7zip and add it to your path.

Execute:

 import os import re import subprocess import time re_svn = re.compile(r'(.)\s+(.+)$') files = [] for line in os.popen('svn status -q').readlines(): match = re_svn.match(line) if match: files.append(match.group(2)) if len(files) > 0: subprocess.call(['7z','a',time.strftime('%Y%m%d-%H%M%S') + '.zip'] + files) 

Note: Python training, but it works.

+1
source

On linux, you will.

svn diff -r REV: HEAD --summarize | sed 's / [A-Za-z] [] + //' | xargs zip myfiles.zip

Where REV is the revision number you want to start with. Usually when you checked.

SOURCE: http://www.semicolon.co.za/linux/get-list-of-changed-tiles-via-svn-diff-and-zip-them.html

+1
source

If you can agree to commit (elsewhere) these changes before canceling (which becomes just svn up PREV-REV ), you can use any "Files changed in the revision"

For TortoiseSVN, the last GUI way ( "Exporting only modified files to TortoiseSVN between versions" ) may be your preferred method

0
source

Although the Boscabouter answer worked fine for me on one machine, on the other machine, I noticed that TortoiseSVN does not have a Shell entry in the context menu. Therefore, I could not easily send files from the Check for Changes dialog box in 7zip.

Based on Ken White's input , I used the command line to move files to the archive:

  1. Open the TortoiseSVN dialog Check for changes, for example, from the base directory of your repository
  2. Mark all the files that interest you, right-click on any file and select Copy paths to clipboard
  3. Paste the paths into a temporary text file, say filelist.txt , in the same directory
  4. Open a terminal in this directory (for example, Shift + right-click this folder in Windows Explorer, then select "Open Command Prompt")
  5. Run "%ProgramFiles%"\7-Zip\7z a -tzip modified.zip @filelist.txt

As an alternative to steps 1 to 3, you can run svn status | find "M " > filelist.txt svn status | find "M " > filelist.txt and delete unnecessary lines / characters with a text editor.

0
source

Source: https://habr.com/ru/post/1412091/


All Articles