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

Re: [PATCH] date_tests.py, version 4

From: Vivek <vivek_at_collab.net>
Date: 2005-07-09 10:36:40 CEST

On Thu, 2005-07-07 at 00:30, kfogel@collab.net wrote:
> You're going to hate me for this, Vivek, but I have an idea:
Oye :)
> Here is what I propose: make the commits, but then hard set the
> svn:date properties on those commits to some known date string, one
> for which we can hardcode the appropriate format strings in the tests.
> Of course, setting svn:date means activating pre-revprop-change hook.
> But we wanted a portable hook setup framework for the regression tests
> anyway, so I think that's more reasonable to depend on than the
> existence of the 'date' command on the system.
> Thoughts?
Rather than hard setting the svn:date why don't we pget svn:date and
manipulate that date so as to match the 'date --iso-8601=seconds'
Here is how:

# The output of GNU date was not being accepted by svn commands
# Test the fix.
def cat_with_date_option(sbox):
   "use GNU date command in revision input"

   wc_dir = sbox.wc_dir

   mu_path = os.path.join(wc_dir, 'A', 'mu')
   # Create the revprop-change hook
   if os.name == 'posix':
     hook = os.path.join(svntest.main.current_repo_dir, 'hooks',
     open(hook, 'w').write("#!/bin/sh\n\nexit 0\n")
     os.chmod(hook, 0755)
   elif sys.platform == 'win32':
     hook = os.path.join(svntest.main.current_repo_dir,
                        'hooks', 'pre-revprop-change.bat')
     open(hook, 'w').write("@exit 0\n")
   out, err = svntest.main.run_svn(1, 'pget', "--revprop", "-r", '1',
                                    'svn:date', sbox.wc_dir)
   if err:
      raise svntest.Failure
   # The string we need should match 'date --iso-8601=seconds'
   date_var = str(out).split('.')[0].split("'")[1].split('-',1)
   date_var[0] = str(string.atoi(date_var[0]) + 1)
   date_var = string.join(date_var,'-') + "+0530"
   # The Success Case: output and no errors.
   svntest.actions.run_and_verify_svn('cat a file using GNU date',
                                      ["This is the file 'mu'.\n"],None,
                                      'cat', '-r', '{' + date_var + '}',

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 9 10:37:36 2005

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