Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/ctypes-python/csvn/txn.py  view on Meta::CPAN

                        copyfrom_rev=src_rev,
                        local_path=local_path)
        else:
            # Mark the directory as copied
            parent.open(dest_path, "ADD",
                        kind, copyfrom_path=src_path,
                        copyfrom_rev=src_rev)

            # Upload any changes from the supplied local path
            # to the remote repository
            self.upload(dest_path, local_path)

    def upload(self, remote_path, local_path):
        """Upload a local file or directory into the remote repository.
           If the given file or directory already exists in the
           repository, overwrite it.

           This function does not add or update ignored files or
           directories."""

        remote_path = self.session._relative_path(remote_path)

        kind = svn_node_none

src/subversion/subversion/bindings/ctypes-python/csvn/txn.py  view on Meta::CPAN

            kind = svn_node_file

        # Don't add ignored files or directories
        if self.ignore_func and self.ignore_func(remote_path, kind):
            return

        if (os.path.isdir(local_path) and
              self.check_path(remote_path) != svn_node_dir):
            self.mkdir(remote_path)
        elif not os.path.isdir(local_path) and os.path.exists(local_path):
            self._upload_file(remote_path, local_path)

        ignores = []

        for root, dirs, files in os.walk(local_path):

            # Convert the local root into a remote root
            remote_root = root.replace(local_path.rstrip(os.path.sep),
                                       remote_path.rstrip("/"))
            remote_root = remote_root.replace(os.path.sep, "/").rstrip("/")

src/subversion/subversion/bindings/ctypes-python/csvn/txn.py  view on Meta::CPAN


            # Add all subdirectories
            for name in dirs:
                remote_dir = "%s/%s" % (remote_root, name)
                self.mkdir(remote_dir)

            # Add all files in this directory
            for name in files:
                remote_file = "%s/%s" % (remote_root, name)
                local_file = os.path.join(root, name)
                self._upload_file(remote_file, local_file)

    def _txn_commit_callback(self, info, baton, pool):
        self._txn_committed(info[0])

    def commit(self, message, base_rev = None):
        """Commit all changes to the remote repository"""

        if base_rev is None:
            base_rev = self.session.latest_revnum()

src/subversion/subversion/bindings/ctypes-python/csvn/txn.py  view on Meta::CPAN

        return self.committed_rev

    # This private function handles commits and saves
    # information about them in this object
    def _txn_committed(self, info):
        self.committed_rev = info.revision
        self.committed_date = info.date
        self.committed_author = info.author
        self.post_commit_err = info.post_commit_err

    # This private function uploads a single file to the
    # remote repository. Don't use this function directly.
    # Use 'upload' instead.
    def _upload_file(self, remote_path, local_path):

        if self.ignore_func and self.ignore_func(remote_path, svn_node_file):
            return

        kind, parent = self._check_path(remote_path)
        if svn_node_none == kind:
            mode = "ADD"
        else:
            mode = "OPEN"

src/subversion/subversion/bindings/ctypes-python/examples/example.py  view on Meta::CPAN

    svn_repos_delete("/tmp/test-repos", Pool())
user = User(username="joecommitter")
repos = LocalRepository("/tmp/test-repos", user=user, create=True)
print("Repos UUID: %s" % repos.uuid())

# Create a new transaction
txn = repos.txn()

# You can create a file from a Python string
open("/tmp/contents.txt", "w").write("Hello world one!")
txn.upload("file1.txt", local_path="/tmp/contents.txt")

# ... or from a Python file
open("/tmp/contents.txt", "w").write("Hello world two!")
txn.upload("file2.txt", local_path="/tmp/contents.txt")

# Create some directories
txn.mkdir("a")
txn.mkdir("a/b")
txn.mkdir("a/d")

# Commit the transaction
new_rev = txn.commit("Create file1.txt and file2.txt. "
                     "Also create some directories")
print("Committed revision %d" % new_rev)

src/subversion/subversion/bindings/ctypes-python/examples/example.py  view on Meta::CPAN

# Copy a to c, but remove one of the subdirectories
txn.copy(src_path="a", dest_path="c")
txn.delete("c/b")

# Copy files around in the repository
txn.copy(src_path="file1.txt", dest_path="file3.txt")
txn.copy(src_path="file2.txt", dest_path="file4.txt")

# Modify some files while we're at it
open("/tmp/contents.txt", "w").write("Hello world one and a half!")
txn.upload("file1.txt", local_path="/tmp/contents.txt")

# Commit our changes
new_rev = txn.commit("Create copies of file1.txt, file2.txt, and some "
                     "random directories. Also modify file1.txt.")
print("Committed revision %d" % new_rev)

# Transaction number 3
txn = repos.txn()

# Replace file3.txt with the new version of file1.txt

src/subversion/subversion/bindings/ctypes-python/examples/example.py  view on Meta::CPAN

    txn.delete("blahdir")
txn.mkdir("blahdir")
txn.mkdir("blahdir/dj")
txn.mkdir("blahdir/dj/a")
txn.mkdir("blahdir/dj/a/b")
txn.mkdir("blahdir/dj/a/b/c")
txn.mkdir("blahdir/dj/a/b/c/d")
txn.mkdir("blahdir/dj/a/b/c/d/e")
txn.mkdir("blahdir/dj/a/b/c/d/e/f")
txn.mkdir("blahdir/dj/a/b/c/d/e/f/g")
txn.upload("blahdir/dj/a/b/c/d/e/f/g/h.txt", "/tmp/contents.txt")

rev = txn.commit("create blahdir and descendents")
print("Committed revision %d" % rev)

def ignore(path, kind):
    basename = os.path.basename(path)
    _, ext = os.path.splitext(basename)
    return (basename == ".svn" or basename.endswith("~") or
            basename.startswith(".") or ext in (".pyc", ".pyo"))

src/subversion/subversion/bindings/ctypes-python/examples/example.py  view on Meta::CPAN

        txn.propset(path, "svn:ignore", "*.py[co]")

    # Set eol-style to native for python files and text files
    if kind == svn_node_file and (path.endswith(".py") or
                                  path.endswith(".txt")):
        txn.propset(path, "svn:eol-style", "native")

txn = session.txn()
txn.ignore(ignore)
txn.autoprop(autoprop)
txn.upload("csvn", local_path="csvn")
rev = txn.commit("import csvn dir")
print("Committed revision %d" % rev)

txn = session.txn()
txn.copy(src_path="csvn", dest_path="csvn2")
txn.upload("csvn2/core/functions.py","/tmp/contents.txt")
rev = txn.commit("Copied csvn to csvn2, messing around with functions.py")
print("Committed revision %d" % rev)

src/subversion/subversion/bindings/ctypes-python/examples/mucc.py  view on Meta::CPAN

    if action == "cp":
        txn.copy(src_rev=args[1], src_path=args[2], dest_path=args[3])
    elif action == "mv":
        txn.delete(str(args[1]))
        txn.copy(src_path=args[1], dest_path=args[2])
    elif action == "rm":
        txn.delete(args[1])
    elif action == "mkdir":
        txn.mkdir(args[1])
    elif action == "put":
        txn.upload(local_path=args[1], remote_path=args[2])
    elif action == "propset":
        txn.propset(key=args[1], value=args[2], path=args[3])
    elif action == "propdel":
        txn.propdel(key=args[1], path=args[2])


# Get the log message
message = options.message
if options.file:
    message = open(options.file).read()

src/subversion/tools/buildbot/slaves/centos/svnlog.sh  view on Meta::CPAN

# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#

set -x

# upload file to server
FILENAME=tests-`date +%Y%m%d%H%M`.log.tgz
tar -czf $FILENAME tests.log
ftp -n www.mobsol.be < ../ftpscript 
rm $FILENAME

echo "Logs of the testrun can be found here: http://www.mobsol.be/logs/eh-debsarge1/$FILENAME"

exit 0

src/subversion/tools/buildbot/slaves/i686-debian-sarge1/svnlog.sh  view on Meta::CPAN

# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#

set -x

# upload file to server
FILENAME=tests-`date +%Y%m%d%H%M`.log.tgz
tar -czf $FILENAME tests.log
ftp -n www.mobsol.be < ../ftpscript 
rm $FILENAME

echo "Logs of the testrun can be found here: http://www.mobsol.be/logs/eh-debsarge1/$FILENAME"

exit 0

src/subversion/tools/buildbot/slaves/svn-x64-macosx-gnu-shared-daily-ra_serf/svnlog.sh  view on Meta::CPAN

#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#

# upload file to server
FILENAME=tests-`date +%Y%m%d%H%M`.log.tgz
tar -czf $FILENAME tests.log
ftp -n www.mobsol.be < ../ftpscript 
rm $FILENAME

echo "Logs of the testrun can be found here: http://www.mobsol.be/logs/osx10.4-gcc4.0.1-ia32/$FILENAME"

exit 0

src/subversion/tools/buildbot/slaves/svn-x64-macosx-gnu-shared/svnlog.sh  view on Meta::CPAN

#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#

# upload file to server
FILENAME=tests-`date +%Y%m%d%H%M`.log.tgz
tar -czf $FILENAME tests.log
ftp -n www.mobsol.be < ../ftpscript 
rm $FILENAME

echo "Logs of the testrun can be found here: http://www.mobsol.be/logs/osx10.4-gcc4.0.1-ia32/$FILENAME"

exit 0

src/subversion/tools/buildbot/slaves/ubuntu-x64/svnlog.sh  view on Meta::CPAN

# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
#

set -x

# upload file to server
FILENAME=tests-`date +%Y%m%d%H%M`.log.tgz
tar -czf $FILENAME tests.log
ftp -n www.mobsol.be < ../ftpscript 
rm $FILENAME

echo "Logs of the testrun can be found here: http://www.mobsol.be/logs/eh-debsarge1/$FILENAME"

exit 0

src/subversion/tools/examples/svnput.c  view on Meta::CPAN

/*
 * svnput.c : upload a single file to a repository, overwriting
 *            any existing file by the same name.
 *
 *   ***************************************************************

 *    WARNING!!  Despite the warnings it gives, this program allows
 *    you to potentially overwrite a file you've never seen.
 *    USE AT YOUR OWN RISK!
 *
 *      (While the repository won't 'lose' overwritten data, the
 *      overwriting may happen without your knowledge, and has the

src/subversion/tools/examples/svnput.c  view on Meta::CPAN

}



int
main (int argc, const char **argv)
{
  apr_pool_t *pool;
  svn_error_t *err;
  apr_hash_t *dirents;
  const char *upload_file, *URL;
  const char *parent_URL, *basename;
  svn_ra_plugin_t *ra_lib;
  void *session, *ra_baton;
  svn_revnum_t rev;
  const svn_delta_editor_t *editor;
  void *edit_baton;
  svn_dirent_t *dirent;
  svn_ra_callbacks_t *cbtable;
  apr_hash_t *cfg_hash;
  svn_auth_baton_t *auth_baton;

  if (argc <= 2)
    {
      printf ("Usage:  %s PATH URL\n", argv[0]);
      printf ("    Uploads file at PATH to Subversion repository URL.\n");
      return EXIT_FAILURE;
    }
  upload_file = argv[1];
  URL = argv[2];

  /* Initialize the app.  Send all error messages to 'stderr'.  */
  if (svn_cmdline_init ("minimal_client", stderr) != EXIT_SUCCESS)
    return EXIT_FAILURE;

  /* Create top-level memory pool. Be sure to read the HACKING file to
     understand how to properly use/free subpools. */
  pool = svn_pool_create (NULL);

src/subversion/tools/examples/svnput.c  view on Meta::CPAN

  if (dirent && dirent->kind == svn_node_file)
    {
      char answer[5];

      printf ("\n*** WARNING ***\n\n");
      printf ("You're about to overwrite r%ld of this file.\n", rev);
      printf ("It was last changed by user '%s',\n",
              dirent->last_author ? dirent->last_author : "?");
      printf ("on %s.\n", svn_time_to_human_cstring (dirent->time, pool));
      printf ("\nSomebody *might* have just changed the file seconds ago,\n"
              "and your upload would be overwriting their changes!\n\n");

      err = prompt_and_read_line("Are you SURE you want to upload? [y/n]",
                                 answer, sizeof(answer));
      if (err) goto hit_error;

      if (apr_strnatcasecmp (answer, "y"))
        {
          printf ("Operation aborted.\n");
          return EXIT_SUCCESS;
        }
    }

  /* Fetch a commit editor (it's anchored on the parent URL, because
     the session is too.) */
  /* ### someday add an option for a user-written commit message?  */
  err = ra_lib->get_commit_editor (session, &editor, &edit_baton,
                                   "File upload from 'svnput' program.",
                                   my_commit_callback, NULL, pool);
  if (err) goto hit_error;

  /* Drive the editor */
  {
    void *root_baton, *file_baton, *handler_baton;
    svn_txdelta_window_handler_t handler;
    svn_stream_t *contents;
    apr_file_t *f = NULL;

src/subversion/tools/examples/svnput.c  view on Meta::CPAN

      {
        err = editor->open_file (basename, root_baton, rev, pool,
                                 &file_baton);
      }
    if (err) goto hit_error;

    err = editor->apply_textdelta (file_baton, NULL, pool,
                                   &handler, &handler_baton);
    if (err) goto hit_error;

    err = svn_io_file_open (&f, upload_file, APR_READ, APR_OS_DEFAULT, pool);
    if (err) goto hit_error;

    contents = svn_stream_from_aprfile (f, pool);
    err = svn_txdelta_send_stream (contents, handler, handler_baton,
                                   NULL, pool);
    if (err) goto hit_error;

    err = svn_io_file_close (f, pool);
    if (err) goto hit_error;

src/subversion/tools/examples/testwrite.c  view on Meta::CPAN

}



int
main (int argc, const char **argv)
{
  apr_pool_t *pool;
  svn_error_t *err;
  apr_hash_t *dirents;
  const char *upload_file, *URL;
  const char *parent_URL, *basename;
  svn_ra_plugin_t *ra_lib;
  void *session, *ra_baton;
  svn_revnum_t rev;
  const svn_delta_editor_t *editor;
  void *edit_baton;
  svn_dirent_t *dirent;
  svn_ra_callbacks_t *cbtable;
  apr_hash_t *cfg_hash;
  svn_auth_baton_t *auth_baton;

src/subversion/tools/examples/testwrite.c  view on Meta::CPAN

  err = svn_ra_get_ra_library (&ra_lib, ra_baton, parent_URL, pool);
  if (err) goto hit_error;

  err = ra_lib->open (&session, parent_URL, cbtable, NULL, cfg_hash, pool);
  if (err) goto hit_error;

  /* Fetch a commit editor (it's anchored on the parent URL, because
     the session is too.) */
  /* ### someday add an option for a user-written commit message?  */
  err = ra_lib->get_commit_editor (session, &editor, &edit_baton,
                                   "File upload from 'svnput' program.",
                                   my_commit_callback, NULL, pool);
  if (err) goto hit_error;

  /* Drive the editor */
  {
    void *root_baton, *file_baton, *handler_baton;
    svn_txdelta_window_handler_t handler;
    svn_stream_t *contents;
    apr_file_t *f = NULL;



( run in 1.497 second using v1.01-cache-2.11-cpan-b16cb0d3907 )