كيف التعامل مع مستودع Subversion

Subversion هو البرنامج الذي يدير مستودع الشفرة المصدرية لـ جامباس على http://sourceforge.net.

المستوع مثل نظام الملفات بالضبط, لكنة نظام ملفات يحتفظ بجيمع التعديلات.

يمكن الحصول على إذن الكتابة في مستودع جامباس .

أي شخص يمكنة أخذ نسخة من المستودع على قرصة الصلب باستخدام الأمر التالي:
$ svn checkout https://gambas.svn.sourceforge.net/svnroot/gambas/gambas/trunk/

لكن اذا كنت تريد تطوير أو ترجمة جامباس, اذا تحتاج الى إذن كتابة في مستودع التطوير.

للحصول على ذلك, إنشيء حساب على sourceforge.net. وإطلب منى أن أمنح إذن كتابة للمستخدم الذي أنشأته للتو .

كيف يعمل؟

في كل مرة يتغير أي شيء في المستودع, رقم المرجع يزيد, و/سجل المراجعة/ يضم إلية. سجل المراجعة يحرر من قبل الشخص الذي أجرى التعديلات.

جميعها تتم بإستخدام أوامر svn .

  • svn checkout إنشاء نسخة من المستودع على قرصك الصلب. ويضيف العديد من أدلة .svn المخفية في كل مكان داخل المستودع لمتابعة التغييرات.

  • svn commit إرسال جميع التعديلات إلى الخادوم. يسأل عن رقم المرجع السابق ثم يزيده. كل عملية إيداع لها رقم مرجع وسجل مراجعة خاص.

  • svn update ترقية نسخة المستودع المحلي على جهازك إلى آخر نسخة من المستودع على الخادوم.

شخص ما قد يكون غير بعض الملفات بين الوقت الذي أنشأت فيه نسخة و وقت الإيداع. لذلك قبل عمل أمر الإيداع svn commit, إعمل أمر تحديث=svn update=.

كتابة سجل المراجعة

عندما تودع, يجب تحديد المحرر الذي سيستخدم في كتابة سجل المرجع في المتغير البيئة $EDITOR . For example:
$ EDITOR=gedit svn commit

لا يمكنك تعديل سجل المراجعة بعد الإيداع. كأن sourceforge عطل هذه الميزة. لذلك , كن حذر!

صيغة سجل المراجعة

أريد أن أضع طريقة قياسيء لكتابة رسائل الإيداع, بحيث يتم إنشاء سجل التغييرات بشكل تلقائي عن طريق معالجة سجل المراجعة,

الصيغة المستخدمة هي:

  • اسم المكون في سجل التغييرات يوضع بين '[' & ']'

  • نوع التعديل يبدأ بـ ثم فراغ ثم كلمة 'BUG', 'NEW' أو 'OPT' ثم : ثم فراغ ثم النص الذي يشرح هذه العملية .

'BUG' تكون لإصلاح مشكلة, 'NEW' في حالة إضافة ميزة, ترجمة, أو تحديث, و 'OPT' تكون في حالة أمثلة الكود.

إسم المكوٍّن يكون بحروف كبيرة, وواحد من التالية:
  • [INTERPRETER]

  • [COMPILER]

  • [ARCHIVER]

  • [INFORMER]

  • [DEVELOPMENT ENVIRONMENT]

  • [DATABASE MANAGER]

  • [CONFIGURATION]

  • [WIKI CGI SCRIPT]

جميع الأسطر يجب أن تكون أقل او مساوية لـ 76 حرف.

إذا كان سجل التغييرات أكثر من سطر واحد, يجب أن تسخدم فراغين متتالين في بداية السطر.

السطر الفراغ سيتم تجاهلة.

أيضا االأسطر الآخرى سيتم تجاهلها ولن تضاف في سجل التغييرات.

Examples

I did this thing, and this won't go into the changelog.

[GB.QT]
* BUG: I fixed this bug.
* NEW: I made this very long modification....
  and it takes more than one line to write it.

This won't go into the chanlog too.

[GB.SDL]
* BUG: What an awful bug!

[GB.GTK]
* NEW: I finally finished the component :-)

الرجاء إتباع هذه الصيغة, ستكون مفيدة جدا...

Commit mailing-list

There is a mailing-list that gets a mail each time somebody commits a new revision. So this way you always know if you have the last revision on your hardisk or not.

To subscribe to this mailing-list, go to the mailing-list page on the web site. The name of the mailing-list is gambas-devel-svn.

حالة نسخة مستودعك

لتحصل على حالة نسخة مستودعك, نفذ أمر svn status .

Each state is described with one or more letter:
  • ? is a file not managed by subversion.

  • M is a file you have modified.

  • C is a file in conflict.

  • G is a file in conflict that was automatically solved by the svn command.

  • A is a newly added file or directory.

  • D is a deleted file or directory.

  • ... and so on.

See above for more information about conflicts.

تحذير

No automatic project structure tracking

You must tell subversion if you add, delete, rename or move a file. You do that with the commands:

  • svn add to add a file you have already created.

  • svn del to remove a file.

  • svn move to rename or move a file.

Forgetting to use svn add is a common mistake. I know what I'm talking about :-)

تضارب

Somebody can modify a file in the repository, while you have modified the same file on your hardisk. This is a conflict, and svn will tell you when running svn update, or the svn status command.

Each time there is conflict, svn tries to solve it automatically, by merging your own changes with the changes made by other people.

If the merge succeed, your will get a file with a 'G' state character.

If the merge didn't succeed, your will get a file with a 'C' state character. Then you will have to solve the conflict by hand:

  • You must edit the file yourself to merge the changes. svn has modified the file so that you see your own changes and the other changes side by side.

  • Or you can use one of the copy automatically made by subversion. You get one for the last version, and one for the current version of your local repository. Their name are the name of the original file followed by a dot, the letter 'r' and the revision number. Just replace the original file by the copy.

Once done, you will tell svn that the conflict is solved by running the svn resolved command on the file in conflict.

هل هناك مجازفة؟

Normally there is no risk, as everything is archived, and so you can always go back in time.

Moreover, if you work on a جامباس project inside the repository, the development environment can deal with all svn command for you. Go to the versioning tab in the project خصائص dialog, and you will find buttons that allow you to update the project, commit it, and cancel your modifications.

If you have made something weird, you can use the svn revert command. It will revert you local copy to the state of the last checkout or update.