[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Updating a locally modified file with endline translation

From: Vladimir Prus <ghost_at_cs.msu.su>
Date: 2002-02-14 15:16:19 CET

Log message:
Fixes a bug that prevented updating a locally modified file when endline
translation for the file is turned on.

    * subversion/libsvn_wc/get_editor.c (svn_wc_install_file): Make path
          for a temporary file relative to the directory where update happens.

    * subversion/tests/clients/cmdline/update_tests.py
          (update_modified_with_translation): New function.

Patch (against rev 1272)

Index: ./subversion/libsvn_wc/get_editor.c
===================================================================
--- ./subversion/libsvn_wc/get_editor.c
+++ ./subversion/libsvn_wc/get_editor.c Thu Feb 14 17:04:57 2002
@@ -1843,6 +1843,13 @@
                                                         FALSE,
                                                         pool));
 
+ /* Make the temporary working file name relative to
+ the parent directory. */
+ tmp_working = svn_stringbuf_ncreate
+ (tmp_working->data + parent_dir->len + 1,
+ tmp_working->len - parent_dir->len - 1,
+ pool);
+
                       /* Copy the working file to tmp-working with
                          LF's, and any keywords contracted. */
 
Index: ./subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/update_tests.py
+++ ./subversion/tests/clients/cmdline/update_tests.py Thu Feb 14 17:04:12
2002
@@ -474,6 +474,48 @@
                                                None, None, None, None, 0,
                                                '-r', '0')
 
+#----------------------------------------------------------------------
+
+def update_modified_with_translation(sbox):
+ "ensure update for locally modified file with eol translation works"
+
+ if sbox.build():
+ return 1
+
+ wc_dir = sbox.wc_dir
+ cwd = os.getcwd()
+ os.chdir(wc_dir)
+
+ # Create initial content of rho and turn on newline translation.
+ rho_path = os.path.join('A', 'D', 'G', 'rho')
+ f = open(rho_path, "w")
+ f.write("1\n2\n3\n4\n5\n6\n7\n8\n9\n")
+ f.close()
+ svntest.main.run_svn(None, 'propset', 'svn:eol-style', 'native', rho_path)
+ svntest.main.run_svn(None, 'ci', '-m', '"log msg"', rho_path)
+
+ # Make immeditate revision
+ f = open(rho_path, "w")
+ f.write("1\n2\n3\n4\n4.5\n5\n6\n7\n8\n9\n")
+ f.close()
+ svntest.main.run_svn(None, 'ci', '-m', '"log msg"', rho_path)
+
+ # Locally modify a file
+ f = open(rho_path, "w")
+ f.write("1\n2\n3\n4\n4.5\n5\n6\n7\n8\n9\n10\n")
+ f.close()
+
+ # Try updating, and see if anything is printed to stderr
+ result = 0
+ if svntest.main.run_svn(None, 'up', '-r1')[1]:
+ result = 1
+
+ os.chdir(cwd)
+
+ return result
+
+
+
 
 ########################################################################
 # Run the tests
@@ -485,6 +527,7 @@
               update_binary_file_2,
               update_ignores_added,
               update_to_rev_zero,
+ update_modified_with_translation,
               # update_missing,
              ]
 
A question:
In the test code above, I have to explicitly change directory to working
copy. Otherwise, all commits/updates fill happen in subversion tree. However,
other tests in update_tests.py don't do that? What am I missing?

- Volodya

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:07 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.