props.c File Reference

Properties handling - prop-get, prop-set, prop-list. More...

#include <sys/types.h>
#include <limits.h>
#include <unistd.h>
#include <gdbm.h>
#include <fcntl.h>
#include <subversion-1/svn_props.h>
#include "global.h"
#include "waa.h"
#include "url.h"
#include "helper.h"
#include "actions.h"
#include "hash_ops.h"
#include "props.h"
#include "update.h"
#include "ignore.h"
#include "est_ops.h"
#include "add_unvers.h"
#include "warnings.h"

Include dependency graph for props.c:

Go to the source code of this file.

Defines

#define FSVS_PROP_PREFIX   "fsvs:"
 The common prefix.
#define FSVS_PROP_COMMIT_PIPE   FSVS_PROP_PREFIX "commit-pipe"
 The name for the commit-pipe property.
#define FSVS_PROP_UPDATE_PIPE   FSVS_PROP_PREFIX "update-pipe"
 The name of the update-pipe property.
#define FSVS_PROP_INSTALL_CMD   FSVS_PROP_PREFIX "install"
 Local install commandline.
#define FSVS_PROP_ORIG_MD5   FSVS_PROP_PREFIX "original-md5"
 The MD5 of the original (un-encoded) data.
propNames Meta-data property names.
Depending on the subversion sources there may be some of these already defined - especially if the header files are from the meta-data branches.

These would override the defaults - but lets hope that they'll always be compatible!

#define SVN_PROP_TEXT_TIME   SVN_PROP_PREFIX "text-time"
#define SVN_PROP_OWNER   SVN_PROP_PREFIX "owner"
#define SVN_PROP_GROUP   SVN_PROP_PREFIX "group"
#define SVN_PROP_UNIX_MODE   SVN_PROP_PREFIX "unix-mode"

Functions

int prp__open_byname (char *wcfile, int gdbm_mode, hash_t *db)
 -.
int prp__open_byestat (struct estat *sts, int gdbm_mode, hash_t *db)
 -.
int prp__set (hash_t db, const char *name, const char *data, int datalen)
 -.
int prp__set_svnstr (hash_t db, const char *name, const svn_string_t *utf8_value)
 -.
int prp__store (hash_t db, datum key, datum value)
 -.
int prp__get (hash_t db, char *keycp, datum *value)
 -.
int prp__set_from_aprhash (struct estat *sts, apr_hash_t *props, enum prp__set_from_aprhash_e flags, hash_t *props_db, apr_pool_t *pool)
 -.
int prp__g_work (struct estat *root, int argc, char *argv[])
 -.
int prp__s_work (struct estat *root, int argc, char *argv[])
 -.
int prp__open_get_close (struct estat *sts, char *name, char **data, int *len)
 -.
int prp__l_work (struct estat *root, int argc, char *argv[])
 -.
int prp__unlink_db_for_estat (struct estat *sts)
 -.

Variables

const char prp___to_be_removed_value []
 -.
char propname_mtime [] = SVN_PROP_TEXT_TIME
 Modification time - svn:text-time.
char propname_owner [] = SVN_PROP_OWNER
 -.
char propname_group [] = SVN_PROP_GROUP
 -.
char propname_origmd5 [] = FSVS_PROP_ORIG_MD5
 -.
char propname_umode [] = SVN_PROP_UNIX_MODE
 -.
char propname_special [] = SVN_PROP_SPECIAL
 -.
char propval_special [] = SVN_PROP_SPECIAL_VALUE
 -.
char propval_commitpipe [] = FSVS_PROP_COMMIT_PIPE
 -.
char propval_updatepipe [] = FSVS_PROP_UPDATE_PIPE
 -.
char propval_orig_md5 [] = FSVS_PROP_ORIG_MD5
 -.


Detailed Description

Properties handling - prop-get, prop-set, prop-list.

Deleted properties are marked locally be a special value; callers need to check by using prp__prop_will_be_removed().

Todo:
--xml, --raw, --dump switches?
Todo:
should prop-get and prop-list use UTF-8 or local encoding? Currently the names and values are dumped as-is, ie. UTF-8.

Definition in file props.c.


Define Documentation

#define SVN_PROP_GROUP   SVN_PROP_PREFIX "group"

Definition at line 281 of file props.c.

#define SVN_PROP_OWNER   SVN_PROP_PREFIX "owner"

Definition at line 278 of file props.c.

#define SVN_PROP_TEXT_TIME   SVN_PROP_PREFIX "text-time"

Definition at line 275 of file props.c.

#define SVN_PROP_UNIX_MODE   SVN_PROP_PREFIX "unix-mode"

Definition at line 284 of file props.c.


Function Documentation

int prp__g_work ( struct estat root,
int  argc,
char *  argv[] 
)

-.

Definition at line 562 of file props.c.

References ac__Usage_this, DEBUGP, hsh__close(), prp__fetch(), prp__open_byname(), prp__prop_will_be_removed(), STOPIF, STOPIF_CODE_EPIPE, and waa__find_common_base().

Here is the call graph for this function:

int prp__get ( hash_t  db,
char *  keycp,
datum *  value 
)

-.

Get a value, addressed by a string; key length is calculated inclusive the \0.

Wrapper for prp__fetch().

Definition at line 446 of file props.c.

References prp__fetch().

Referenced by prp__open_get_close(), and up__fetch_decoder().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__l_work ( struct estat root,
int  argc,
char *  argv[] 
)

int prp__open_byestat ( struct estat sts,
int  gdbm_mode,
hash_t db 
)

-.

Open a property file, by struct estat.

Returns ENOENT silently.

Definition at line 367 of file props.c.

References ops__build_path(), prp__open_byname(), and STOPIF.

Referenced by ops__apply_group(), prp__open_get_close(), prp__s_work(), prp__set_from_aprhash(), and up__fetch_decoder().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__open_byname ( char *  wcfile,
int  gdbm_mode,
hash_t db 
)

-.

Open a property file, by WC-path.

Just a wrapper for the normal property operation.

Must be silent for ENOENT, so that fsvs pl * doesn't give an error.

Definition at line 351 of file props.c.

References hsh__new(), STOPIF, and WAA__PROP_EXT.

Referenced by prp__g_work(), prp__l_work(), and prp__open_byestat().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__open_get_close ( struct estat sts,
char *  name,
char **  data,
int *  len 
)

-.

Open, fetch, close a property hash corresponding to sts and name.

data and len are optional output parameters, ie. may be NULL. if data is used, it must be free()d.

Returns ENOENT silently.

Definition at line 750 of file props.c.

References hsh__close(), IF_FREE, prp__get(), prp__open_byestat(), and STOPIF.

Here is the call graph for this function:

int prp__s_work ( struct estat root,
int  argc,
char *  argv[] 
)

int prp__set ( hash_t  db,
const char *  name,
const char *  data,
int  datalen 
)

-.

Set a property by name and data/datalen.

If datalen is -1, strlen(data) is used.

Definition at line 384 of file props.c.

References BUG_ON, prp__store(), and STOPIF.

Referenced by prp__set_svnstr().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__set_from_aprhash ( struct estat sts,
apr_hash_t *  props,
enum prp__set_from_aprhash_e  flags,
hash_t props_db,
apr_pool_t *  pool 
)

-.

Writes the given set of properties of sts into its prop file.

The meta-data of the entry is overwritten with the data coming from the repository; its estat::remote_status is set. If props_db is not NULL, the still opened property database is returned.

Todo:
  • store in utf-8? local encoding? What if it's binary??? Better do no translation, ie store as UTF-8.

Definition at line 462 of file props.c.

References DEBUGP, HASH_REMEMBER_FILENAME, hsh__close(), ONLY_KEEP_USERDEF, prp__open_byestat(), prp__set_svnstr(), prp__unlink_db_for_estat(), STOPIF, STORE_IN_FS, and up__parse_prop().

Referenced by ops__apply_group(), rev__get_props(), rev__get_text_to_stream(), and rev__install_file().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__set_svnstr ( hash_t  db,
const char *  name,
const svn_string_t *  utf8_value 
) [inline]

-.

Set a property by svn_string_t.

Convenience function. The svn_string_t has the number of characters used, whereas we store the \0 at the end, too.

Definition at line 423 of file props.c.

References prp__set().

Referenced by prp__set_from_aprhash().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__store ( hash_t  db,
datum  key,
datum  value 
)

-.

Store the value; basic function.

Definition at line 433 of file props.c.

References DEBUGP, hsh__store(), and STOPIF.

Referenced by prp__s_work(), and prp__set().

Here is the call graph for this function:

Here is the caller graph for this function:

int prp__unlink_db_for_estat ( struct estat sts  ) 

-.

Definition at line 870 of file props.c.

References ops__build_path(), STOPIF, waa__get_gwd_flag(), waa__get_waa_directory(), and WAA__PROP_EXT.

Referenced by prp__set_from_aprhash().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char propname_group[] = SVN_PROP_GROUP

-.

Group - svn:group.

Definition at line 309 of file props.c.

Referenced by ci___set_props(), and up__parse_prop().

char propname_mtime[] = SVN_PROP_TEXT_TIME

Modification time - svn:text-time.

Property names from the subversion name-space

FSVS has a number of reserved property names, where it stores the meta-data and other per-entry data in the repository.

Property names from the subversion name-space

Such names are already in use in the mtime and meta-data branches of subversion; we use the values defined in svn_props.h (if any), or use the originally used values to be compatible.

These start all with the string defined in SVN_PROP_PREFIX, which is svn: .

Definition at line 305 of file props.c.

Referenced by ci___set_props(), and up__parse_prop().

char propname_origmd5[] = FSVS_PROP_ORIG_MD5

-.

Original MD5 for encoded entries.

Definition at line 311 of file props.c.

Referenced by ci__nondir(), and up__parse_prop().

char propname_owner[] = SVN_PROP_OWNER

-.

Owner - svn:owner.

Definition at line 307 of file props.c.

Referenced by ci___set_props(), and up__parse_prop().

char propname_special[] = SVN_PROP_SPECIAL

-.

Flag for special entry.

Subversion defines that for symlinks; we use that for devices, too.

Definition at line 316 of file props.c.

Referenced by ci__nondir(), rev__install_file(), and up__parse_prop().

char propname_umode[] = SVN_PROP_UNIX_MODE

-.

Unix mode - svn:unix-mode.

Definition at line 313 of file props.c.

Referenced by ci___set_props(), and up__parse_prop().

char propval_commitpipe[] = FSVS_PROP_COMMIT_PIPE

-.

Commit-pipe program.

This will get the local file as STDIN, and its output goes to the repository. See FSVS_PROP_COMMIT_PIPE.

Definition at line 323 of file props.c.

Referenced by ci___send_user_props().

char propval_orig_md5[] = FSVS_PROP_ORIG_MD5

-.

Definition at line 330 of file props.c.

char propval_special[] = SVN_PROP_SPECIAL_VALUE

-.

The value for the special property; normally "*".

Definition at line 318 of file props.c.

Referenced by ci__nondir(), and up__parse_prop().

char propval_updatepipe[] = FSVS_PROP_UPDATE_PIPE

-.

Update-pipe program.

This will get the repository file as STDIN, and its output goes to a local temporary file, which gets installed. See FSVS_PROP_UPDATE_PIPE.

Definition at line 328 of file props.c.

Referenced by rev__get_text_to_stream(), sync___recurse(), up__fetch_decoder(), and up__parse_prop().

Initial value:

    "FSVS:INTERNAL-\nto-be-removed\n-"
    "\x8f\xc1\xa6\xe5\x86\x0a\x01\x72\x54\x89\x25\x23\x03\xc3\xfa\x75"
-.

Value string for to-be-removed properties.

I thought about using "constant prefix.$random" => "$propertyname" for them - but it's more work than simply ignoring them before listing.

And as they're not widely used, it's easier this way.

Definition at line 340 of file props.c.

Referenced by prp__prop_will_be_removed(), and prp__s_work().


Generated for fsvs by  doxygen 1.5.9