Crucible tried to anchor your patch, but there was conflicting content - patch

I'm trying to use Crucible with CVS for precommit review. When I upload the patch, it says
Crucible tried to anchor your patch, but there was conflicting content
Apparently this is a common problem. hits in jira.
All my files have keyword tag $Log: NameOfTheFile.java,v $ and this seems to be the culprit. If I remove the tag and commit, the problem goes away -- I can upload precommit patches to Crucible. However I do not want to remove all the keyword tags from my files.
Is there any other work-around? One page says I can manually edit the diff. How??

The problem is that CVS expands the keyword during checkout. Therefore the copy of the file in CVS has the unexpanded tag, but the copy on your PC has the expanded tag. This is what causes the anchor to fail. In the case of $Log$ the expansion adds three lines after the tag. To make the anchor work you have to edit the patch such that those three lines disappear. You have two options
generate the patch with all lines, cvs diff -u100000, and then edit the patch to remove the three lines after the $Log$, or
generate the patch with limited context, cvs diff -u, and then edit the patch to subtract 3 from all the "##" lines. For instance if the patch contains "## -116,63 +109,50 ##" you will need to change it to "## -113,63 +106,50 ##"
This is related to the off by one bug when you look at the log in the CVS file.

Related

Git: problems creating a repository

I'm attempting to incorporate a WordPress website into Git.
I've created a local repository through GitHub for Mac, and I've edited the "Primary remote repository" to the HTTPS URL under the Settings tab, after which I've then applied some ignore patterns.
So far this has worked.
However, when I look at the items under the Changes tab, I'm seeing entries for the ".gitignore" file and everything in the "wp-content" folder but nothing above it.
I don't think it's the ignore patterns because some of the default WordPress templates are in there, and a load of OS items, each of which have been ignored, but I understand the ignore patterns won't be applied until after a commit.
At the bottom of the list of entries to commit, the path is correct and not within the "wp-content" folder.
So why are things like "wp-admin" and "wp-config.php" — or any other root item — missing?
Is there a maximum length to the number of items GitHub for Mac can show, but if so, why show "wp-content" when other items precede it in alphabetical order?
I'm a bit confused as to what's happening. At this point, nothing has been committed, and I'm hesitant to do so if part of the website is missing.
This is the section that's causing it:
#===================================#
# WP Core, except content #
#===================================#
/*
!.gitignore
!wp-content/
# !media/
!favicon.ico
!favicon.png
!robots.txt
!humans.txt
Notice the leading /*. This means that it's ignoring EVERYTHING by default. From the documentation:
A leading slash matches the beginning of the pathname.
The wildcard * then tells it to match everything in that path.
The exclamation point ! then refers to items which explicitly should NOT be ignored.

Passing the current commandline to a zsh autocomplete function

I track my billable hours. Every item has a description and a number of tags for different clients, projects etc.
Recently I added zsh completion for these tags. This is what I have in my zsh autocompletion file now:
_arguments "*:tags:( $(cat timetrackingdata | extract_tags.py ) )"
The python script extract_tags.py extracts all tags in my timetrackingdata file and gives them back to zsh.
I'd like to able to limit the tags returned by the tags already on the command line
So if I've already put the tag client1 on the command line I want to pass this tag to extract_tags.py so that it can filter it's output and only return tags that occur on items that also have the tag client1.
I think what you are looking for is the $words variable. This is an array of all words specified on the command line that magically exists inside completion functions.
Where is that documented? There are some passing references in man zshcompsys that I would have missed were I not specifically looking for them. However, I found it more clearly highlighted on this website.

zsh: completion menu. How to place common part of names?

I have completion menu configured in my zsh. It works great, no problem.
Now I want to make my zsh act like that:
Let's say there are 3 files in a directory:
somefile_first
somefile_second
somefile_third
Now when I press [TAB], I get completion menu with the first file placed in the command line.
But I want zsh to complete the common part of file names (in this example it would be somefile_), do not place anything else after the common part, and let me navigate through completion menu.
How do I do that?
I realize this question is old but I stumbled upon it when looking for the same answer. Here is what I found out.
AFAIK when using completion menu zsh will always place highlighted completion in the command line. However you can make it less hasty.
unsetopt menucomplete
setopt automenu
Changes the behaviour so
first TAB completes the common part
second lists completions without changing command line
third starts the menu and completes command line with highlighted completion
If you prefer no command line changes than fancy menu unset automenu too:
unsetopt menucomplete automenu
That gives bash-like completion. Only common part is completed and propositions are listed.

Migration to new domain

I'm working on a drupal 6 site at mydomain.com/drupalsite, and the designer has put a lot of hardcoded image paths in there, for instance a custom img folder in mydomain.com/drupalsite/img. So a lot of the site uses links to /drupalsite/img/myimg1.png.
Here's the problem -- the site is eventually moving to finaldomain.com, via pointing finaldomain.com to mydomain.com/drupalsite. So now paths like /drupalsite/img/myimg1.png will resolve to finaldomain.com/drupalsite/img/myimg1.png, instead of what should be finaldomain.com/img/myimg1.png. The finaldomain.com site has to point to that subdirectory so it hits the index.php.
My first instinct is to use an .htaccess file to replace the /drupalsite with "", but I've tried about a dozen different solutions and they haven't worked. My hack of a solution was to use some ln -s links but I really don't like it :) tia
Andrew
The best method, in hindsight, is to ensure folks use Drupal functions to make all links:
l (that's the letter L)
drupal_get_path()
base_path()
The l() function takes care of base path worries, and provides a systematic way to define your URL's. Using things like theme_image() plus the l() function are a sure win. Use the second and third functions above if you have to write your own <a> tags and for use inside theme functions like theme_image().
But for your current situation:
As regards Andy's solution, it would be better if you could limit your changes to certain database fields where you know the links are located.
So write a query to select all those fields (e.g. all body fields):
$my_query = db_query("SELECT vid, body FROM {node_revisions}");
This, for example, will get you every body field in the node_revisions table, so even your old revisions would have proper links.
Then run through those results, do str_replace() on each, and then write the changes back:
while($node = db_fetch_object($my_query)) {
$new_body = str_replace('what you have', 'what you want', $node->body);
db_query("UPDATE {node_revisions} SET body = '%s' WHERE vid = %d", $new_body, $node->vid);
}
I'd obviously try it on one record first, to make sure your code behaves as intended (just add a WHERE vid = 5, for example, to narrow it down to one revision). Furthermore, I haven't taken advantage of node_load and node_save, which are better for loading and saving nodes properly, so as to provide a more general solution (for you to replace text in blocks, etc.).
For your files, I'd suggest a good ol' sed command, by running something like the following from within your "sites" folder:
find ./ -type f -exec sed -i ’s/string1/string2/’ {} \;
Nabbed that from here, so take a look on that site for more explanation. If you're going to be working with paths, you'll either need to escape the / of the paths in your version of the sed command, or use a different sed separator (i.e. you can write s#string1#string2# instead of s/string1/string2/, so you could write s#/drupalsite/img/#/img# instead of s/\/drupalsite\/img\//\/img/ :-). See also Drupal handbook page for quick sed commands: http://drupal.org/node/128513.
A bit of a mess, which is why I try to enforce using the proper functions up front. But this is difficult if you want themers to create Drupal content but you don't want to give them access to the "PHP Filter" input format, or they simply don't know PHP. Proper Drupal theming, at any point past basic HTML/CSS work, requires a knowledge of PHP and Drupal's theme-related functions.
I've done this before by taking a full database dump, opening it in a text editor, and doing a global search and replace on the paths. Then on the new host, load the modified dump file, and it will have the correct paths in.
You could try Pathologic, it should be able to correct paths like this.

Insert programming code in a Lyx document

What is the best way of inserting python/C++ code in a Lyx document? The code is small examples less than 20 lines.
My Lyx document is using the Book document class.
Orjanp
I prefer to insert the listings as a child document, so the code is grabbed directly from a file that you can further edit and keep updated (you avoid to duplicate an information and maintenance is a lot easier).
To do this in Lyx:
Insert->File->Child document
Then in the window that will appear change the type to program listing and configure it as you need, for example you could want to enter the parameter language=Python (you can type a ? to view all the parameters).
A set of parameters I usually use is:
breaklines=true //--> breaks lines to margin
captionpos=b //--> caption at the bottom of the listing (default is "t")
frame=tb //--> frame at the top and at the bottom of the listing
language=Python //--> syntax highlighting for python
There should be an Insert -> Program Listing option. That uses listings Latex package, so you should have that installed. The support seems to have been added in Lyx 1.5, and from their screenshot, it seems it gives you a lot of customization options.
The insert->Program Listing feature works great. I just want to add that if you are on Mac, and try to directly paste, using command+V or right-click+paste, a block of code into the program listing, the whitespace will not be preserved, and you have to manually insert the whitespace by typing tabs, returns, etc.
A very easy way to get around this is is to paste using shift+command+V. This preserves all the whitespace of your original source code.

Resources