$ drush dl pathauto --version-control=bzr --bzrsync --bzrcommit
gives:

Project pathauto (7.x-1.0-alpha2) downloaded to                      [success]
/home/USER/web/drupal-7/sites/example.com/modules/pathauto.
Problems were encountered committing your changes to Bazaar.         [error]
The specific errors are below:
Committing to: /home/USER/web/drupal-7/sites/example.com/
aborting commit write group: PathsNotVersionedError(Path(s) are not
versioned: modules/pathauto)
bzr: ERROR: Path(s) are not versioned: modules/pathauto

Further details: /home/USER/web/drupal-7/sites/example.com/ is a symbolic link pointing at: /home/USER/web/example

CommentFileSizeAuthor
#7 drush-1004562_02.patch967 byteskdebaas
#6 drush-1004562.patch2.83 KBkdebaas

Comments

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this with a simple setup. Could you paste the whole output using --debug?

kdebaas’s picture

$ cvs update -dPA
[snip]
$ drush st version
 Drupal version   :  7.0-rc3 
 Drush version    :  4.0-dev 
$ drush dl --package-handler=bzr --bzrsync --bzrcommit --debug advanced_help
Bootstrap to phase 0. [0.01 sec, 2.55 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.77 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.04 sec, 5.79 MB]                        [bootstrap]
Initialized Drupal 7.0-rc3 root directory at /home/klaas/web/drupal-7 [0.05 sec, 7.31 MB]            [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 7.32 MB]                        [bootstrap]
Initialized Drupal site postpolitikak.org at sites/postpolitikak.org [0.05 sec, 7.33 MB]             [notice]
Loading drushrc "/home/klaas/web/postpolitikak/drushrc.php" into "site" scope. [0.05 sec, 7.33 MB][bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.06 sec, 7.34 MB]               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.06 sec, 7.35 MB]                    [bootstrap]
Successfully connected to the Drupal database. [0.06 sec, 7.35 MB]                                [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.06 sec, 8.12 MB]                        [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_login() [0.21 sec, 30.94 MB]                      [bootstrap]
Successfully logged into Drupal as Anonymous (uid=0) [0.21 sec, 31.43 MB]                         [bootstrap]
Found command: pm-download (commandfile=pm) [0.21 sec, 31.43 MB]                                  [bootstrap]
Initializing drush commandfile: user [0.21 sec, 31.43 MB]                                         [bootstrap]
No  was set for including the package_handler engine bzr. [0.22 sec, 31.46 MB]                    [error]
PHP Fatal error:  Call to undefined function package_handler_validate() in /home/klaas/web/drush/commands/pm/pm.drush.inc on line 1931
Drush command terminated abnormally due to an unrecoverable error.                                [error]
Error: Call to undefined function package_handler_validate() in
/home/klaas/web/drush/commands/pm/pm.drush.inc, line 1931 [0.22 sec, 31.45 MB]
moshe weitzman’s picture

Bzr is not a package handler

kdebaas’s picture

Status: Postponed (maintainer needs more info) » Active

True. Woops! Correct debug output below:

$  drush dl --version-control=bzr --bzrsync --bzrcommit --debug advanced_help
Bootstrap to phase 0. [0.01 sec, 2.55 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.77 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.03 sec, 5.79 MB]        [bootstrap]
Initialized Drupal 7.0-rc3 root directory at /home/klaas/web/drupal-7 [0.05 sec,     [notice]
7.31 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.05 sec, 7.32 MB]        [bootstrap]
Initialized Drupal site postpolitikak.org at sites/postpolitikak.org [0.05 sec,      [notice]
7.33 MB]
Loading drushrc "/home/klaas/web/postpolitikak/drushrc.php" into "site" scope.    [bootstrap]
[0.05 sec, 7.33 MB]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.05 sec, 7.34   [bootstrap]
MB]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.05 sec, 7.35 MB]    [bootstrap]
Successfully connected to the Drupal database. [0.05 sec, 7.35 MB]                [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.06 sec, 8.12 MB]        [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_login() [0.21 sec, 30.94 MB]      [bootstrap]
Successfully logged into Drupal as Anonymous (uid=0) [0.21 sec, 31.43 MB]         [bootstrap]
Found command: pm-download (commandfile=pm) [0.21 sec, 31.43 MB]                  [bootstrap]
Initializing drush commandfile: user [0.21 sec, 31.43 MB]                         [bootstrap]
Executing: wget --version
Downloading release history from                                                     [notice]
http://updates.drupal.org/release-history/advanced_help/7.x [0.22 sec, 31.51 MB]
Executing: mkdir '/tmp/drush_tmp_1293722132'
Downloading project advanced_help to /tmp/drush_tmp_1293722132 ... [1.63 sec,        [notice]
31.52 MB]
Calling chdir(/tmp/drush_tmp_1293722132)
Executing: wget -P . 'http://ftp.drupal.org/files/projects/advanced_help-7.x-1.x-dev.tar.gz'
  --2010-12-30 16:15:32--  http://ftp.drupal.org/files/projects/advanced_help-7.x-1.x-dev.tar.gz
  Resolving ftp.drupal.org... 64.50.233.100, 64.50.236.52
  Connecting to ftp.drupal.org|64.50.233.100|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 81439 (80K) [application/x-gzip]
  Saving to: `./advanced_help-7.x-1.x-dev.tar.gz'
  
       0K .......... .......... .......... .......... .......... 62% 6.26K 5s
      50K .......... .......... .........                       100% 26.9K=9.1s
  
  2010-12-30 16:15:42 (8.75 KB/s) - `./advanced_help-7.x-1.x-dev.tar.gz' saved [81439/81439]
  
Downloading advanced_help-7.x-1.x-dev.tar.gz was successful. [11.68 sec, 31.52 MB]   [notice]
Calling md5_file(advanced_help-7.x-1.x-dev.tar.gz)
Md5 checksum of advanced_help-7.x-1.x-dev.tar.gz verified. [11.68 sec, 31.52 MB]     [notice]
Executing: gzip -d 'advanced_help-7.x-1.x-dev.tar.gz'
Executing: tar -xf 'advanced_help-7.x-1.x-dev.tar'
Calling unlink(advanced_help-7.x-1.x-dev.tar)
Calling chdir(/home/klaas/web/drupal-7)
Using destination directory                                                          [notice]
/home/klaas/web/drupal-7/sites/postpolitikak.org/modules [11.71 sec, 31.52 MB]
Verifying signature for bzr version control engine. [11.71 sec, 31.54 MB]             [debug]
Executing: bzr root '/home/klaas/web/drupal-7/sites/postpolitikak.org/modules'
  /home/klaas/web/postpolitikak
Calling is_readable(/tmp/drush_tmp_1293722132/advanced_help)
Calling is_writable(/home/klaas/web/drupal-7/sites/postpolitikak.org/modules)
Calling rename(/tmp/drush_tmp_1293722132/advanced_help, /home/klaas/web/drupal-7/sites/postpolitikak.org/modules/advanced_help)
Project advanced_help (7.x-1.x-dev) downloaded to                                 [success]
/home/klaas/web/drupal-7/sites/postpolitikak.org/modules/advanced_help. [11.85
sec, 31.58 MB]
Executing: bzr status --short '/home/klaas/web/drupal-7/sites/postpolitikak.org/modules/advanced_help'
  ?   modules/advanced_help/
  ?   modules/advanced_help/LICENSE.txt
  ?   modules/advanced_help/advanced-help-popup.tpl.php
  ?   modules/advanced_help/advanced_help.info
  ?   modules/advanced_help/advanced_help.install
  ?   modules/advanced_help/advanced_help.module
  ?   modules/advanced_help/help/
  ?   modules/advanced_help/help-icon.css
  ?   modules/advanced_help/help-popup.css
  ?   modules/advanced_help/help.css
  ?   modules/advanced_help/help.png
  ?   modules/advanced_help/help_example/
  ?   modules/advanced_help/translations/
Executing: bzr root '/home/klaas/web/drupal-7/sites/postpolitikak.org/modules/advanced_help'
  /home/klaas/web/postpolitikak
Executing: bzr commit --message='Drush automatic commit.
Project: advanced_help module
Command: /home/klaas/web/drush/drush.php dl --version-control=bzr --bzrsync --bzrcommit --debug advanced_help --php=/usr/bin/php' '/home/klaas/web/drupal-7/sites/postpolitikak.org/modules/advanced_help'
  Committing to: /home/klaas/web/drupal-7/sites/postpolitikak.org/
  aborting commit write group: PathsNotVersionedError(Path(s) are not versioned: modules/advanced_help)
  bzr: ERROR: Path(s) are not versioned: modules/advanced_help
Problems were encountered committing your changes to Bazaar.                      [error]
The specific errors are below:
Committing to: /home/klaas/web/drupal-7/sites/postpolitikak.org/
aborting commit write group: PathsNotVersionedError(Path(s) are not versioned:
modules/advanced_help)
bzr: ERROR: Path(s) are not versioned: modules/advanced_help [12.31 sec, 31.58 MB]
Project advanced_help contains 2 modules: help_example, advanced_help.
Command dispatch complete [12.31 sec, 31.54 MB]                                      [notice]
 Timer  Cum (sec)  Count  Avg (msec) 
 page   12.26      1      12259.95   

Peak memory usage was 31.65 MB [12.31 sec, 31.54 MB]                                 [memory]
kdebaas’s picture

drush dl --version-control=bzr --bzrsync --bzrcommit --debug advanced_help works well when performed in Drupal root. The module is downloaded to sites/all.

The problem is that my web/drupal-7/sites/postpolitikak.org dir is a symlink pointing at web/politikak.org, which is itself a bzr branch. So in the following lines 76 - 94 in bzr.inc, $root[0] is never equal to $project['full_project_path'] on line 84:

        // All paths returned by bzr status are relative to the repository root.
        if (drush_shell_exec('bzr root %s', $project['full_project_path'])) {
          $root = drush_shell_exec_output();
        }
        foreach ($output as $line) {
          if (preg_match('/^\?\s+(.*)/', $line, $matches)) {
            $path = $root[0] .'/'. $matches[1];
            // Bazaar add is by default recursive so only run on "full_project_path".
            if (($path == $project['full_project_path'] .'/') && !drush_shell_exec('bzr add %s', $path)) {
              $errors .= implode("\n", drush_shell_exec_output());
            }
          }
          else if (preg_match('/^\s+D\s+(.*)/', $line, $matches)) {
            $path = $root[0] .'/'. $matches[1];
            if (!drush_shell_exec('bzr remove %s', $path)) {
              $errors .= implode("\n", drush_shell_exec_output());
            }
          }
        }

Since Bazaar is recursive anyway, can't we skip the foreach, and do a Bazaar add on the $project['full_project_path']?

kdebaas’s picture

Title: bzrsync doesn't work » bzrsync doesn't work with symlinked directories that are bzr root
Version: All-versions-4.0-rc3 »
Status: Active » Needs review
StatusFileSize
new2.83 KB

In the attached patch, a bzr add is performed on the $project['full_project_path'], leaving it up to bzr to figure out the bzr root. Since add is recursive, there is no need to iterate over the bzr status --short output. I left bzr status --short in, to be able to collect error messages.

I removed the foreach loop that 'bzr removes' deleted files, since they are implicitly removed on 'bzr commit'. As I type this, though, I realize that one may want to do a bzrsync without doing a bzr commit. I can't think of a scenario yet in which one would want to have the deleted files of a drush pm-update explicitly removed from version control before bzr commit removes them, so I don't know what the consequences of this could be.

kdebaas’s picture

StatusFileSize
new967 bytes

The new patch is more modest: $path is not compared to $project['full_project_path'] anymore, and the option --no-recurse is added to bzr add, so that directories and files aren't added recursively anymore, but one by one. Better?

moshe weitzman’s picture

Assigned: Unassigned » jonhattan

Looks pretty simple and proper to me. Maybe jonhattan has some feedback. Anyone else?

jonhattan’s picture

Status: Needs review » Fixed

I did commit #7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.